<?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 build a request query with Python OntapAPI in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23217#M935</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for answer Eugene. Zexplore doesn't seem to help me, however.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I wish to avoid spending several lines by building a hierarchy of &lt;EM&gt;NaElement &lt;/EM&gt;objects to get a simple "state = restricted" filtering query, which is what Zexplore does. Instead, I look for an elegant way to directly pass &lt;EM&gt;query &lt;/EM&gt;or &lt;EM&gt;desired-attributes&lt;/EM&gt; arguments to &lt;EM&gt;invoke &lt;/EM&gt;method, not to &lt;EM&gt;invoke_elem &lt;/EM&gt;one. Something in the way of the example I've provided in original post.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of quite chaotic this:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14089167673636590" jivemacro_uid="_14089167673636590"&gt;&lt;P&gt;api = NaElement("volume-get-iter")&lt;/P&gt;&lt;P&gt;xi = NaElement("desired-attributes")&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;api.child_add(xi)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi1 = NaElement("volume-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi.child_add(xi1)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi1.child_add_string("volume-id-attributes","&amp;lt;volume-id-attributes&amp;gt;")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi2 = NaElement("query")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;api.child_add(xi2)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi3 = NaElement("volume-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi2.child_add(xi3)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi4 = NaElement("volume-state-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi3.child_add(xi4)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi4.child_add_string("state","restricted")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xo = s.invoke_elem(api)&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to write something like this:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_140891676731679" jivemacro_uid="_140891676731679" modifiedtitle="true"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;xo = s.invoke(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-get-iter"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, "desired-attributes", ("volume-attributes", ("volume-id-attributes",)), &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"query"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-attributes"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-state-attributes"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"state"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"restricted"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;))))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just wonder if the Python Ontapi implements similar syntax. I have tried to use that without success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Lukas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 24 Aug 2014 21:25:30 GMT</pubDate>
    <dc:creator>kukacz123</dc:creator>
    <dc:date>2014-08-24T21:25:30Z</dc:date>
    <item>
      <title>How to build a request query with Python OntapAPI</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23207#M933</link>
      <description>&lt;P&gt;Hi, I'm trying to specify a results-limiting query while listing volumes by OntapAPI 5.2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if there's some easy way to build the query, similar to?:&lt;/P&gt;
&lt;P&gt;my_vserver_connection.invoke("volume-get-iter", "max-records", 10000, "query", ("volume-attributes", ("volume-state-attributes", ("state", "restricted"))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can build the query using series of NaElement objects - that's a lot of lines of code, however.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lukáš&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 05:30:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23207#M933</guid>
      <dc:creator>kukacz123</dc:creator>
      <dc:date>2025-06-05T05:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a request query with Python OntapAPI</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23211#M934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lukas -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried using the Zexplore tool ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a drag and drop of volume-get-iter with the language set to Python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a lot of lines of code that resulted - 563.&lt;/P&gt;&lt;P&gt;A lot of them are for setting all of the optional attribute elements, and could be deleted.&lt;/P&gt;&lt;P&gt;But it only took about 10 seconds to drag and drop and get the code ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Aug 2014 20:35:50 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23211#M934</guid>
      <dc:creator>ekashpureff</dc:creator>
      <dc:date>2014-08-24T20:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a request query with Python OntapAPI</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23217#M935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for answer Eugene. Zexplore doesn't seem to help me, however.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I wish to avoid spending several lines by building a hierarchy of &lt;EM&gt;NaElement &lt;/EM&gt;objects to get a simple "state = restricted" filtering query, which is what Zexplore does. Instead, I look for an elegant way to directly pass &lt;EM&gt;query &lt;/EM&gt;or &lt;EM&gt;desired-attributes&lt;/EM&gt; arguments to &lt;EM&gt;invoke &lt;/EM&gt;method, not to &lt;EM&gt;invoke_elem &lt;/EM&gt;one. Something in the way of the example I've provided in original post.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of quite chaotic this:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14089167673636590" jivemacro_uid="_14089167673636590"&gt;&lt;P&gt;api = NaElement("volume-get-iter")&lt;/P&gt;&lt;P&gt;xi = NaElement("desired-attributes")&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;api.child_add(xi)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi1 = NaElement("volume-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi.child_add(xi1)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi1.child_add_string("volume-id-attributes","&amp;lt;volume-id-attributes&amp;gt;")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi2 = NaElement("query")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;api.child_add(xi2)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi3 = NaElement("volume-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi2.child_add(xi3)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi4 = NaElement("volume-state-attributes")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;xi3.child_add(xi4)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xi4.child_add_string("state","restricted")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;xo = s.invoke_elem(api)&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to write something like this:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_140891676731679" jivemacro_uid="_140891676731679" modifiedtitle="true"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;xo = s.invoke(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-get-iter"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, "desired-attributes", ("volume-attributes", ("volume-id-attributes",)), &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"query"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-attributes"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"volume-state-attributes"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, (&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"state"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: helvetica, arial; color: blue; background-color: #ffffff;"&gt;"restricted"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: helvetica, arial; color: #000000; background-color: #ffffff;"&gt;))))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just wonder if the Python Ontapi implements similar syntax. I have tried to use that without success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Lukas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Aug 2014 21:25:30 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-build-a-request-query-with-Python-OntapAPI/m-p/23217#M935</guid>
      <dc:creator>kukacz123</dc:creator>
      <dc:date>2014-08-24T21:25:30Z</dc:date>
    </item>
  </channel>
</rss>

