You are not logged in.
Pages: 1
Hi everyone how can i post solution for a ticket using api because this request not working https://serveurglpi/apirest.php/ticketsolution/?session-token=xxxxxxxxxxxxxxxxxxx
ty
Offline
Hi,
glpi version ?
try using POST METHOD with this URL :
$url=$api_url ."/ITILSolution/";
and this payload :
$payload='{
"input": {
"items_id": "'.$ticket_id.'",
"content": "this is my solution",
"solutiontypes_id": 2,
"itemtype": "Ticket",
}
}';
//print_r($fields);
$ch = curl_init();
$url=$api_url ."/ITILSolution/";
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
Hi!
Any idea why is not working with version 9.5.5?
I'm able to add solution manually, but using REST API is not working. When solution is added manually I can close ticket with API without any problems.
EDIT:
{ "input": {"items_id": "TICKET_ID" ,"content": "SOLUTION" ,"solutiontypes_id": "2" ,"itemtype": "Ticket"}}
My payload looks like above and I use the same method to load it as in the changing status operation, which basically works.
Strange thing is that response I receive looks completely the same as I tried to run 'ItitlSolution' request with no payload. No exception appears even when I did a mess with my payload structure.
I was wondering if maybe read-only session is the cause, but set up 'get_full_session=True' and 'session_write=1' also did not worked.
Last edited by questioning (2022-01-04 11:11:07)
Offline
Hi!
I tried to post this but got an error return "ERROR_BAD_ARRAY"
Any idea why I got the error?
try using POST METHOD with this URL :
$url=$api_url ."/ITILSolution/";
and this payload :
$payload='{
"input": {
"items_id": "'.$ticket_id.'",
"content": "this is my solution",
"solutiontypes_id": 2,
"itemtype": "Ticket",
}
}';
Offline
I'm pretty sure most JSON decoders don't like trailing commas.
Does it work if you remove the comma at the end of the "itemtype" line?
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
Nope, same error
i try it using postman with
method: POST
URL: http://xxxx/apirest.php/ITILSolution/
auth: basic auth with glpi username and password
body:
{
"input":{
"itemtype": "Ticket",
"items_id": "59939",
"content":"MySolutionDescription",
"status" : 2
}
}
I've tried to remove the quotation mark on the items_id value but still didn't work
Offline
{
"input": {
"items_id": 3,
"content": "this is my solution",
"users_id": 12,
"solutiontypes_id": 2,
"itemtype": "Ticket",
}
where 3 is your ticket id, and current user is 12.
use this to send als POST to ITILSolution.
Last edited by akpwijnen (2023-09-18 14:32:21)
Offline
{
"input": {
"items_id": 3,
"content": "this is my solution",
"users_id": 12,
"solutiontypes_id": 2,
"itemtype": "Ticket",
}where 3 is your ticket id, and current user is 12.
use this to send als POST to ITILSolution.
Thank you, akpwijnen.
First time it worked for me.
Last edited by vinicius.n.aguiar (2024-11-25 02:36:10)
Offline
Pages: 1