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

#26 2019-09-26 14:31:19

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

LaDenrée wrote:

for debug purpose only :

uncomment echo $ticket_id;


after each " $json = curl_exec($ch);"   add    "print_r($json); "

then run from console "php zabbix-close-ticket.php 24109"

glpi should return some usefull infos about what is wrong


I did it

At least I get that message now:

{"session_token":"an session_token"}{"totalcount":1,"count":1,"sort":1,"order":"ASC","data":[{"2":202,"1":"PROBLEM:glpi-teste fora do ar! Evento 24109 gerado automaticamente pelo Zabbix & GLPI."}],"content-range":"0-0/1"}202["ERROR_BAD_ARRAY","input parameter must be an array of objects; view documentation in your browser at ]http://my-ip/apirest.php/#ERROR_BAD_ARRAY"]["ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM","resource not found or not an instance of CommonDBTM; view documentation in your browser at ]http://my-ip/apirest.php/#ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM"]

I saw that Every time I run the command in terminal, get a new session_token.

Last edited by mecmav (2019-09-26 14:34:45)

Offline

#27 2019-09-26 14:40:32

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

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

json_encode($fields)  =>   $fields is allready a $json !


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

#28 2019-09-26 14:44:20

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

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

I saw that Every time I run the command in terminal, get a new session_token.

it's OK.  ( init session creates a new token )


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

#29 2019-09-26 14:48:17

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

LaDenrée wrote:

json_encode($fields)  =>   $fields is allready a $json !

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));


should I remove this json_encode($fields) at line 67?

Offline

#30 2019-09-26 14:59:09

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

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);


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

#31 2019-09-26 15:06:03

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

LaDenrée wrote:

curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);

Nice !

The ticket corresponding that event was closed !

But after run receive a message with got this error:

{"session_token":"my-session_token"}{"totalcount":1,"count":1,"sort":1,"order":"ASC","data":[{"2":195,"1":"PROBLEM:glpi-teste fora do ar! Evento 23928 gerado automaticamente pelo Zabbix & GLPI."}],"content-range":"0-0/1"}195{"id":11,"message":"Item Successfully Added: Solution - ID 11"}["ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM","resource not found or not an instance of CommonDBTM; view documentation in your browser at http://my-ip/apirest.php/#ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM"]

Note that I need to insert another event, because that first was closed.


But in GLPI, the ticket was closed succesfully.

That error is showing because are printing $json?

Last edited by mecmav (2019-09-26 15:06:49)

Offline

#32 2019-09-26 15:34:50

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

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

["ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM","resource not found or not an instance of CommonDBTM; view documentation in your browser at http://my-ip/apirest.php/#ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM"]


this is about killsession.=>    killSession   with S instead s


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

#33 2019-09-26 15:55:21

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: [SOLVED]Zabbix open ticket in GLPI 9.4.2 Native API without webservice

LaDenrée wrote:

["ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM","resource not found or not an instance of CommonDBTM; view documentation in your browser at http://my-ip/apirest.php/#ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM"]


this is about killsession.=>    killSession   with S instead s

Man, I don't have enough words to thank you. Now everything is working as expected. Thank you for your extreme patience and collaboration, I really appreciate your commitment and dedication to trying to solve my problem. If I could rate you, it would be above the highest possible grade. Everything worked !

Now, this topic can be closed, I expect that can help to any others!

Offline

Board footer

Powered by FluxBB