Pulling Specific Data from XML Response
An API call can fetch a huge amount of data depending on the data (records) in your account for a corresponding API request. Instead of getting the entire data, if you wish to get only specific elements, you can do so with the use of the ?fields= argument in an API request.
The fields argument takes specific element names as input. You can also provide nested elements with each element in the XPath separated by a dot(.).
For example, while querying for the manifest version for VM, you can provide the argument as follows:
?fields=agentInfo.manifestVersion.vm
This corresponds to the XML structure shown below.
<HostAsset>
<id>7866685</id>
<name>ip-172-31-3-82.ap-south-1.compute.internal</name>
<created>2018-08-01T09:34:44Z</created>
<modified>2018-08-10T08:39:49Z</modified>
...
<agentInfo>
...
<platform>Linux</platform>
<activatedModule>AGENT_VM</activatedModule>
<manifestVersion>
<vm>VULNSIGS-VM-0.12.1.0-17</vm>
<pc>VULNSIGS-SCA-0.17.0.0-27</pc>
For an example of an API call using the ?fields= argument, see Get manifest version for an agent.