Hi
I am having an issue using the REST API to update the dynamicCriteriaXML attribute (0x12a6a) for a Global Collection.
This works fine when I use a XML element such as <model-class> ... however I cannot get it to work when the XML element has a sub-element such as <attribute id="0x1295d>. I have tried this using Postman as well as curl and get the same results. Funnily enough when I try updating using Spectrum CLI it works fine :-)
As an example the following curl statement works fine and updates the search criteria for my GC to find models where the model-class is 2. The equivalent XML that I am updating the attribute 0x12a6a with is as follows ...
<search-criteria>
<devices-only-search />
<filtered-models>
<and>
<equals>
<model-class>2</model-class>
</equals>
</and>
</filtered-models>
</search-criteria>
And the curl command is as follows ...
curl -s -X PUT --header 'content-type: application/xml' -u joebloggs:password "http://spectrum:8080/spectrum/restful/model/0x30c45dc?attr=0x12a6a&val=%3Csearch-criteria%3E%0A%3Cdevices-only-search%20/%3E%0A%3Cfiltered-models%3E%0A%3Cand%3E%0A%3Cor%3E%0A%3Cequals%3E%0A%3Cmodel-class%3E2%3C/model-class%3E%0A%3C/equals%3E%0A%3C/or%3E%0A%3C/and%3E%0A%3C/filtered-models%3E%0A%3C/search-criteria%3E%0A"
In the following example I am trying to set the the search criteria to find models where the isManaged attribute (0x1295d) is false. The equivalent XML is as follows ...
<search-criteria>
<devices-only-search />
<filtered-models>
<and>
<equals>
<attribute id="0x1295d">
<value>false</value>
</attribute>
</equals>
</and>
</filtered-models>
</search-criteria>
And the curl command ...
curl -s -X PUT --header 'content-type: application/xml' -u joebloggs:password "http://spectrum:8080/spectrum/restful/model/0x30c45dc?attr=0x12a6a&val=%3Csearch-criteria%3E%0A%3Cdevices-only-search%20/%3E%0A%3Cfiltered-models%3E%0A%3Cand%3E%0A%3Cequals%3E%0A%3Cattribute%20id=%220x1295d%22%3E%0A%3Cvalue%3Efalse%3C/value%3E%0A%3C/attribute%3E%0A%3C/equals%3E%0A%3C/and%3E%0A%3C/filtered-models%3E%0A%3C/search-criteria%3E%0A"
But this does not work ... And the error I get is ...
Invalid attribute value: Error reading search criteria file /opt/spectrum/tomcat/webapps/spectrum/./WEB-INF/<search-criteria>
<devices-only-search />
<filtered-models>
<and>
<equals>
<attribute id.xml:
So it looks to me that it is not interpreting the "id" component of <attribute id="0x1295d"> ...
Has anyone come across this and has a resolution?
Regards, John