You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2019-04-30 17:24:18

BlueLegend78
Member
Registered: 2019-04-30
Posts: 3

Beginner: Issue with Getting All Items

Hi,

I am just getting started with the glpi API and run into this issue while querying for "all items" from a collection.

The docs say the url is

URL: apirest.php/:computer/  would return me the entire list of machines. However, I am only getting like 32 machines when its suppose to return 500~

furthermore, when i use "Get an item" to get a single item, and use a script to iterate through 500 ids, I am able to get the information of all 500~ machines

URL: apirest.php/:computer/:id

Any thoughts?

Thanks!

Offline

#2 2019-04-30 17:46:29

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,163

Re: Beginner: Issue with Getting All Items

did you set range ?

$url="/Computer/?is_deleted=0&range=0-500&get_hateoas=0";


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

#3 2019-04-30 17:51:28

BlueLegend78
Member
Registered: 2019-04-30
Posts: 3

Re: Beginner: Issue with Getting All Items

LaDenrée wrote:

did you set range ?

$url="/Computer/?is_deleted=0&range=0-500&get_hateoas=0";

Ah, Ic yup that just fixed it.

Thanks for the quick responds!

Offline

#4 2019-05-02 17:29:41

BlueLegend78
Member
Registered: 2019-04-30
Posts: 3

Re: Beginner: Issue with Getting All Items

follow up question, when query /computers the json it returns includes the  "links" entry which has DeviceGraphicCard linked to /Computer/256/DeviceGraphicCard/.
But when i go on that url, it gives back a whole list of graphics cards instead of the one linked to that specific machine.

How would i query the graphics card specific to that machine?

Offline

Board footer

Powered by FluxBB