Software Development Kit (SDK) and API Discussions

Syntax to Filter result from DFM API with resource-filter

masson
2,467 Views

Hello Community,

 

Sorry about that beginner question, but I really can't find the info

I'm trying to filter a request sent to OCUM.

The example is about cluster-iter, but i have the same problem with all other API when resource-filter is used

I cannot figure out the syntax to use with resource-filter

 

By example, without any resource-filter when i query OCUM about cluster-iter, i get all cluster registered into OCUM:

 

# curl --insecure -d '<?xml version="1.0" encoding="UTF-8"?> <netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0"> <cluster-iter> <max-records>10</max-records> </cluster-iter> </netapp>' https://admin:password@<ocumIP>/apis/XMLrequest
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE netapp SYSTEM 'http://127.0.0.1:9999/netapp_server.dtd'><netapp xmlns="http://www.netapp.com/filer/admin" version="1.0">
<results status="passed">
<num-records>6</num-records>
<records>
<cluster-info>
<cluster-address>10.65.180.106</cluster-address>
<cluster-diagnosis-status>degraded</cluster-diagnosis-status>
<cluster-name>ClusterA</cluster-name>
<cluster-status>Error</cluster-status>
<cluster-version>9.2</cluster-version>
<datasource-id>2</datasource-id>
<last-update-time>1505926372</last-update-time>
<licenses><license>
<description>SnapVault License</description>
<owner-name>ClusterA</owner-name>....

If i want to filter result and only get information for one particular cluster, i need to use resource-filter.

But i don't find the correct syntax and always get the same error:

# curl --insecure -d '<?xml version="1.0" encoding="UTF-8"?> <netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0"> <cluster-iter> <max-records>10</max-records> <resource-filter><ul><li>ClusterA</ul></resource-filter> </cluster-iter> </netapp>' https://admin:netapp@10.65.180.6/apis/XMLrequest
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE netapp SYSTEM 'http://127.0.0.1:9999/netapp_server.dtd'><netapp xmlns="http://www.netapp.com/filer/admin" version="1.0">
<results status="failed" reason="ParseError at [row,col]:[1,168] Message: Expected EndElement {http://www.netapp.com/filer/admin}resource-filter" errno="13001"/></netapp>

ZEXPLORER indicate the following:

 

<!--Resource by which to filter the result set. Any resource-filters specified in the first call must be included in subsequent calls. The allowed object types for this argument are: <ul> <li> cluster </ul> If resource-filter identifies a cluster, that single cluster will be returned. If resource-filter resolves to more than one cluster, all of them will be returned. If no resource-filter is provided, all clusters will be listed.-->

 

Does anybody know the resource-filter syntax to filter resource from DFM API result?

 

TIA

1 REPLY 1

arminwiesel_fts
2,115 Views

I ran into the same problem and tried it this way with no success:

 

<cluster-node-iter>
        <resource-filter>
                <cluster>my_cluster</cluster>
        </resource-filter>
</cluster-node-iter>

 

It results in this message:

 

Error:\n<results status="failed" reason="ParseError at [row,col]:[1,301] Message: Expected EndElement {http://www.netapp.com/filer/admin}resource-filter" errno="13001"></results>

 

Any hints to get it working?

Public