You are not logged in.
Pages: 1
GLPI API post to /apirest.php/Line
Trying to batch import lines via the api, but every time I do a POST to http://glpi/apirest.php/Line it responds back like I did a GET. Is there no POST option to /apirest.php/Line ? Am I doing it wrong? My post body has JSON formatted data, etc. I'm using the linestype_id, etc.
GLPI Version: 10.0.16
Linux: RHEL 9.4
NGINX
PHP 8.3.12
Last edited by ap1234 (2024-10-10 15:22:06)
Offline
I've troubleshot this a lot with postman and curl and I believe I'm not formatting my array properly, but I'm unsure of exactly how it wants it.
["ERROR_BAD_ARRAY","input parameter must be an array of objects;
I've tried formatting my array with minimal fields returned via the GET and I've also tried a full blown entry with all the fields. I ran my JSON through linting and it all checks out. Anyone have any ideas?
Offline
I was able to get it, in case anyone was wondering you just have to read the API documentation more thoroughly...
curl -X POST 'https://path/to/your/glpi/apirest.php/Line' \
-H 'Content-Type: application/json' \
-H "Session-Token: YOUR_SESSION_TOKEN" \
-H "App-Token: YOUR_APP_TOKEN" \
-d '{
"input": {
"name": "Test Line",
"caller_num": "(123) 456-7890",
"lineoperators_id": 1,
"linetypes_id": 1,
"states_id": 5,
"locations_id": 0
}
}'
Offline
Pages: 1