Python Discussions

samples not working

cdudev
2,382 Views

hi

 

I am a new netapp sdk user. I am trying to execute some Python samples that are included with the SDK. I always get the error 'unable to find api. Are there tutorials or manuals for beginners available?

 

Best regards

2 REPLIES 2

ericwarnke
2,332 Views

Long time python hacker, new to netapp as well.  Check the perl docs for cDOT api references ( doc/perldoc/OntapClusterAPI.html ) just remeber that the calls for perl are things like system_api_list you would actually be the api call 'system-api-list' so  `s.invoke('system-api-list')` or `s.invoke_elem(NaElement('system-api-list', ''))`.  If you need to pass paramaters to a call it's just `s.invoke(api, parameter1, value1, parameter2, value2, ...)` 

 

A lot of calls end in `get-iter` which all follow the same pattern of needing the tag recycled to fetch more.  Here is one example.

 

https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/python-code-for-calling-the-quota-report-iter-API/td-p/121805

 

Be careful there since setting the version to 1,3 will preclude you setting the vserver... you need 1,15 or higher to set the vserver.  The code itself is not very clean and is very ugly, I've started to put wrappers around the NetApp code to simplify things.

 

If you want there is a full set of all API references in a javadoc style format stored in the jar file for zexplore ( unzip zexplore.jar and look in the doc folder. )

gaurav_verma
2,284 Views

"unable to find api" generally occur when API and ONTAP version does not match.

In python check this syntax s = NaServer(filer_name, 1 , 32). 1,32 here is API verison 1.32 and different versions have different API version support. For example for Cluster mode it should be s = NaServer(filer_name, 1 , 32) and for 7 mode s = NaServer(filer_name, 1 , 21)

Public