<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to pass policy.id as variable in GET request on /protocols/nfs/export-policies/{policy.id}/r in ONTAP Rest API Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157900#M77</link>
    <description>&lt;P&gt;You can use an f-string if you're using python 3.6 or above. So, you would do something like:&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;response = requests.get(url=f"https://{clus_lif}/api/protocols/nfs/export-policies/{policy_id}/rules", auth = ("***", "****"), headers={"accept":"application/hal+json"}, verify=False), &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;where clus_lif and policy_id are variables in my script. I gave this a shot and it worked for me.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Also, in case you're not aware, I wanted to share that we have a netapp_ontap python module that you can use if you're writing scripts that access the ONTAP REST API. It'll definitely make your life a lot easier and is more object oriented. See info here:&amp;nbsp;&lt;A href="https://pypi.org/project/netapp-ontap/" target="_blank"&gt;https://pypi.org/project/netapp-ontap/&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jul 2020 13:19:59 GMT</pubDate>
    <dc:creator>Twesha</dc:creator>
    <dc:date>2020-07-21T13:19:59Z</dc:date>
    <item>
      <title>How to pass policy.id as variable in GET request on /protocols/nfs/export-policies/{policy.id}/rules</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157857#M74</link>
      <description>&lt;P&gt;I have an export-policy with policy.id as 8179334014 and would like to retrieve all the rules information under this export-policy and I can do this if I run below command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;response = requests.get('&lt;A href="https://cluster-lif/api/protocols/nfs/export-policies/{8179334014}/rules" target="_blank"&gt;https://cluster-lif/api/protocols/nfs/export-policies/{8179334014}/rules&lt;/A&gt;', auth = ('xxxx', 'xxxx'), headers = {'accept' : 'application/hal+json' }, verify = False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if I want to pass variable instead of value "8179334014" say like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;policy_id =&amp;nbsp; 8179334014&lt;/P&gt;
&lt;P&gt;response = requests.get('&lt;A href="https://cluster-lif/api/protocols/nfs/export-policies/{policy_id}/rules" target="_blank"&gt;https://cluster-lif/api/protocols/nfs/export-policies/{policy_id}/rules&lt;/A&gt;', auth = ('xxxx', 'xxxx'), headers = {'accept' : 'application/hal+json' }, verify = False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It doesnt work as its treating policy_id&amp;nbsp; as value,&amp;nbsp; looking for help to find a solution for this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:00:38 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157857#M74</guid>
      <dc:creator>Juluri</dc:creator>
      <dc:date>2025-06-04T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass policy.id as variable in GET request on /protocols/nfs/export-policies/{policy.id}/r</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157900#M77</link>
      <description>&lt;P&gt;You can use an f-string if you're using python 3.6 or above. So, you would do something like:&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;response = requests.get(url=f"https://{clus_lif}/api/protocols/nfs/export-policies/{policy_id}/rules", auth = ("***", "****"), headers={"accept":"application/hal+json"}, verify=False), &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;where clus_lif and policy_id are variables in my script. I gave this a shot and it worked for me.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Also, in case you're not aware, I wanted to share that we have a netapp_ontap python module that you can use if you're writing scripts that access the ONTAP REST API. It'll definitely make your life a lot easier and is more object oriented. See info here:&amp;nbsp;&lt;A href="https://pypi.org/project/netapp-ontap/" target="_blank"&gt;https://pypi.org/project/netapp-ontap/&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 13:19:59 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157900#M77</guid>
      <dc:creator>Twesha</dc:creator>
      <dc:date>2020-07-21T13:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass policy.id as variable in GET request on /protocols/nfs/export-policies/{policy.id}/r</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157901#M78</link>
      <description>&lt;P&gt;Thats Super!!!, its working, thank you very much Twesha.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 14:03:51 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/How-to-pass-policy-id-as-variable-in-GET-request-on-protocols-nfs-export/m-p/157901#M78</guid>
      <dc:creator>Juluri</dc:creator>
      <dc:date>2020-07-21T14:03:51Z</dc:date>
    </item>
  </channel>
</rss>

