You are not logged in.


 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 2018-09-02 18:19:40

Registered: 2018-09-02
Posts: 1

Create a ticket using python requests any help?

Hi guys, I'm tryung to create a ticket in GLPI, using python requests. My code:

from glpi import GLPI
import requests
url = ''
auth = ('username', 'password')
headers = {'App-Token': 'token',
           'Content-Type': 'application/json'}
requests.get(url, auth=auth, headers=headers)
payload = {'input': {'name': 'Проблема', 'content': 'Не работает компьютер', 'entities_id': 29}}'', json=payload)

But the ticket is not creating, and there is no exception in my script.

Process finished with exit code 0

What I'm doing wrong? Someone can help me?
And should I use encoding to utf-8 to russian text?


#2 2018-09-06 10:22:15

Registered: 2012-11-19
Posts: 4,354

Re: Create a ticket using python requests any help?

initsession should return a session_token.

add this session_token to headers to call other endpoints  ( .../Ticket)

Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.3.3(behaviours2.1.1+fusion9.3+1.3+applicatifs2.4.1+dashboard 0.8.9)hebergé sur serveur mutualisé.
*GLPI 9.4.0  en test (ubuntu 18.04 mariadb 10.2.4)


Board footer

Powered by FluxBB