fields icon indicating copy to clipboard operation
fields copied to clipboard

API's /search/AllAssets doesn't work with custom fields in the criterion

Open felipefv opened this issue 4 years ago • 0 comments

I'm trying to search for all assets on GLPI's API. I'm using a custom field as a criterion. When I try to search for the asset specifying a itemtype like "Computer" or "Monitor" it works, however "AllAssets" fails.

All the assets have been configured to have the same custom field (id 76665).

This works: curl -X GET -v -H "Content-Type: application/json" -H "App-Token: xyz" -H "Session-Token: xyz" http://127.0.0.1/glpi/apirest.php/search/Computer?criteria\[0\]\[field\]\=76665\&criteria\[0\]\[searchtype\]\=contains\&criteria\[0\]\[value\]\=testing123

This doesn't work: curl -X GET -v -H "Content-Type: application/json" -H "App-Token: xyz" -H "Session-Token: xyz" http://127.0.0.1/glpi/apirest.php/search/AllAssets?criteria\[0\]\[field\]\=76665\&criteria\[0\]\[searchtype\]\=contains\&criteria\[0\]\[value\]\=testing123

It just gives back an error message telling me to take a look at the documentation.

Is there anything I can do to make it work?

Thanks for the help!

felipefv avatar Jun 20 '20 02:06 felipefv