You are not logged in.
Pages: 1
Hello everybody,
How can I get printers connected to a specific computer (computer ID) using API request .
TY.
Offline
I tried using this URL : http://myglpiserver/glpi/search/apirest.php/printer/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^Computer_ID$
But I keep getting the same response :
{
"totalcount": 0,
"count": 0,
"sort": "1",
"order": "ASC",
"content-range": "0--1/0"
}
even when there is a printer conencted to taht computer
Offline
That seems to work properly for me. The only thing is the API endpoint URL is wrong but I think that is just a typo here.
The correct URL should be:
"/apirest.php/search/Printer/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^Computer_ID$"
Note that the "search" part is after "apirest.php". Also, even though it works both ways for me, the current API is case-sensitive in some cases for item types, so "printer" should be "Printer".
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
That's weird, and really confusing me, I think I'm doing everything right tho :
this is the printer connected with computer with id 3 :
https://ibb.co/H7hgRxg
but when I use this URL : myglpiserver/glpi/apirest.php/search/Printer/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^3$
I get this response :
https://ibb.co/LP2ZS0M
when doing the same thing with software it works fine.
this is the software installed in computer with id 3 :
https://ibb.co/cLmzrhq
and when I use the same URL only changing printer with software : myglpiserver/glpi/apirest.php/search/Printer/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^3$
I get this response :
https://ibb.co/8N1R84M
....
Offline
Does the user you are using to connect to the API have multiple profiles?
If so, can you check the correct one is active with "apirest.php/getActiveProfile/"?
Also, which version of GLPI are you using?
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
No the user i'm using has a super admin profile and does not have multiple profiles .
the glpi version I'm using is 9.5.4
Offline
I was testing with 10.0.3.
The only suggestion I have currently is to try updating to at least the latest bug fix version of 9.5.X which is 9.5.9 currently and see if this is a bug that was already fixed.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Pages: 1