API apirest.php : unable to retrieve custom field value
Hello,
I am using GLPI 9.5.1, fields 1.11.0, PHP 7.4.7 I have created a block attached to the Project item type.
GET /Project/1/
While those queries do give data with GLPI 9.3.4 + Fields 1.8.2
Is this a bug or a feature ?
Thank you
Hello,
I am using GLPI 9.5.1, fields 1.11.0, PHP 7.4.7 I have created a block attached to the Project item type.
GET /Project/1// gives no output (no error message) GET // gives no output (no error message)
While those queries do give data with GLPI 9.3.4 + Fields 1.8.2
Is this a bug or a feature ?
Thank you
Hello,
Anything about this problem ? I have the same error, i can't put the 9.5 version of GLPI because we use scripts with the fields plugin.
The fields added to the assets by plugin fields are not visible by the Rest API.
GLPI 10.0 Fields 1.14.0
Not exactly, it could be a little bit tricky, but its possible. I use custom fields only for 'Computer' objects, so all examples below are about Computer.
- You should determine ID via API request for available search options like this - https://glpi/apirest.php/listSearchOptions/Computer
- Among all other option in the very bottom of the list you'll find IDs like "76665", you can recognize your wanted custom fields by their names
- Just use these IDs in requests like this - https://glpi/apirest.php/search/Computer?criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][field]=76665&criteria[0][searchtype]=equals&criteria[0][value]=1&&forcedisplay[0]=76666
Hope it helps. Cheers
Thank you for the update.
Since my initial post, I have found a way to get the data I was looking for. I get the custom fileds values through a query like GET /PluginFieldsProject<custom_field_bloc_name>/
As far as I am concerned this topic can be closed.
Can you, please, elaborate on your method via providing full example if possible, because I'm unable to find API endpoint like PluginFieldsProject in glpi :(
GLPI 9.5.11 Plugin fields 1.12.8
For object type Project, create a new block named "addon" through the plugin fields.
The content of this block can be queried with:
GET /PluginFieldsProjectaddon/
PluginFieldsProjectaddon comes from PluginFields
You can find the object name in the files generated in [...]/glpi/files/_plugins/fields/inc.
Is this any clearer?
Yeah, found it. Looks really weird, but i see what you mean. Thank you.
Is this method still working on GLPI 10?
I fail to retrieve (via API) the value of a field I created for Computers.
Method described in my post is still a thing. https://github.com/pluginsGLPI/fields/issues/398#issuecomment-1348808991