Api - glpi

gentlemen, I’m trying to create a call in GLPI through the API provided by the tool. The documentation asks you to do the following:

curl -X POST -H ‘Content-Type: application/json’ -H “Session-Token: xxxxxxxx” -d ‘{“input”: {“name”: “Ticket Name”, “content”: “Ticket Desc”}}’ ‘http://glpiserver/apirest.php/Ticket/

the URL is: http://xxx/apirest.php/Ticket/

for the input:

name: ticket title
content: ticket description
itilcategories_id: ticket category id
type: ticket type id
locations_id : location id

you get session token from initsession:
$ curl -X GET
-H ‘Content-Type: application/json’
-H “Authorization: Basic base64({login}:{password})”
-H “App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7”
http://xxx/apirest.php/initSession

my difficulty is in the parameters below:

for the input:

name: ticket title
content: ticket description
itilcategories_id: ticket category id
type: ticket type id
locations_id : location id

I did it this way, but it returns a message I think I must be doing something wrong but I don’t know how it should be, can someone help me?

Hi @Rodrigo_Lima, welcome to the community!

This looks like an error coming from the API you are calling, seemingly complaining about a bad array. Your request doesn’t seem to require an array though, so I am not 100% sure what’s needed here. Perhaps you can check with the team managing the API you are calling how exactly your request should look like?

Rodrigo, I’m passing through the same issues. Ive been using GLPI API. BTW, i send you a message. Hope we help each other

I’m not sure if you’ve already solved this issue, but the new version of n8n has an option to import a curl command, and it helped me solve this problem.

1 Like

Hello guys.
I’ve been trying to do the same, using Python and curl.

I got the same error or 200 OK but no update.

Did you guys happen to know the solution?

Thanks