#Accessing ZAPIs with cURL

1 messages · Page 1 of 1 (latest)

marsh sparrow
minor yarrow
#

it's XML-RPC, so it should be possible with curl/wget, just not very practical due to the large XML files and the complex queries

mortal helm
#

hi @marsh sparrow here's an example sending the system-get-version

replace $user, $pass, $ip

curl -k -u $user:$pass -d '<?xml version="1.0" encoding="UTF-8"?> <netapp xmlns="http://www.netapp.com/filer/admin" version="1.30"> <system-get-version/> </netapp>' -H "Content-Type: text/xml" -X POST https://$ip/servlets/netapp.servlets.admin.XMLrequest_filer

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE netapp SYSTEM "file:/etc/netapp_gx.dtd">
<netapp xmlns="http://www.netapp.com/filer/admin" version="1.251">
  <results status="passed">
    <build-timestamp>1716526990</build-timestamp>
    <is-clustered>true</is-clustered>
    <version>NetApp Release Mightysquirrel__9.15.1: Fri May 24 05:03:10 UTC 2024</version>
    <version-tuple>
      <system-version-tuple>
        <generation>9</generation>
        <major>15</major>
        <minor>1</minor>
      </system-version-tuple>
    </version-tuple>
  </results>
</netapp>
marsh sparrow
#

thank you both! will give it a try

#
$ curl -k -u $CREDS -d '<?xml version="1.0" encoding="UTF-8"?> <netapp xmlns="http://www.netapp.com/filer/admin" version="1.30"> <system-get-version/> </netapp>' -H "Content-Type: text/xml" -X POST https://$IP/servlets/netapp.servlets.admin.XMLrequest_filer

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_gx.dtd'>
<netapp version='1.231' xmlns='http://www.netapp.com/filer/admin'>
<results status="passed"><build-timestamp>1707916306</build-timestamp><is-clustered>true</is-clustered><version>NetApp Release 9.13.1P7D3: Wed Feb 14 13:11:46 UTC 2024</version><version-tuple><system-version-tuple><generation>9</generation><major>13</major><minor>1</minor></system-version-tuple></version-tuple></results></netapp>

that was easy.. though mine is not as nicely formatted as Chris'!

minor yarrow
#

the trick is to specify "xml" after the three backticks 😉

marsh sparrow
#

ooh hold on then


<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_gx.dtd'>
<netapp version='1.231' xmlns='http://www.netapp.com/filer/admin'>
<results status="passed"><build-timestamp>1707916306</build-timestamp><is-clustered>true</is-clustered><version>NetApp Release 9.13.1P7D3: Wed Feb 14 13:11:46 UTC 2024</version><version-tuple><system-version-tuple><generation>9</generation><major>13</major><minor>1</minor></system-version-tuple></version-tuple></results></netapp>

minor yarrow
#
<foo><bar>...</bar></foo>

vs

<foo><bar>...</bar></foo>
marsh sparrow
#

hmm the indenting is still borked

minor yarrow
#

hm, indeedn, but I think he might have faked that 😉

marsh sparrow
#

gasp

#

I just tried aggr-get-iter and it's an unreadable mess. but it works!

#

thank you both 🙂

minor yarrow
#

you can add | xmlstarlet fo to the curl command if you have xmlstarlet installed to pretty-print it. I assume there are also some other nice XML pretty-printers out there

mortal helm
#

i pass it through xml fo to format

minor yarrow
mortal helm
#

yep

minor yarrow
#

it's pretty neat since it can also do ad-hoc XML selections via XPath (without having to write a separate xslt file)