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

#1 2020-08-04 10:44:50

Alex_Z
Member
Registered: 2020-08-04
Posts: 1

I can't get a ticket ID.

Good day.
Please, help!..
There is a script in Bash that creates a ticket.

#! /bin/bash
      user_token=""  # this user token 

      session=$(curl -X GET -H 'Content-Type: application/json' -H "Authorization: user_token $user_token" -H "App-Token: $user_token" 'http://IP.IP.IP.IP/glpi/apirest.php/initSession')
      session_id=$(echo $session | column -s ":" -t | awk '{print $2}' | cut -c 2- | rev | cut -c 3- | rev )

      type_ticket="2" #
      status_ticket="2" #
      urgency_ticket="5" #
      impact_ticket="3" #
      priority_ticket="4" #
      itilcategories_id_ticket="157" 
      requesttypes_id_ticket="6" 	
      name_ticket="Port_445"
      content_ticket="test-test-test"
      locations_id_ticket="10" # 
      slas_id_ttr_ticket="121" # 
      curl -H POST -H 'Content-Type: application/json' -H "Session-Token: $session_id" -H "App-Token: $user_token" \
         -d'{
	      "input": {
		   "name": "'"${name_ticket}"'", 
		   "content": "'"${content_ticket}"'",
		   "type": "'"${type_ticket}"'",
		   "status": "'"${status_ticket}"'",
		   "urgency": "'"${urgency_ticket}"'",
		   "impact": "'"${impact_ticket}"'",
		   "priority": "'"${priority_ticket}"'",
		   "itilcategories_id": "'"${itilcategories_id_ticket}"'",
		   "requesttypes_id": "'"${requesttypes_id_ticket}"'",
		   "locations_id": "'"${locations_id_ticket}"'",
		   "slas_id_ttr": "'"${slas_id_ttr_ticket}"'"
		}
	}' \
      'http://IP.IP.IP.IP/glpi/apirest.php/Ticket/'

      curl -X GET -H 'Content-Type: application/json' -H "Session-Token: $session_id" -H "App-Token: $user_token" 'http://10.81.1.8/glpi/apirest.php/killSession'

The ticket is created, but CURL returns nothing. There are no messages described in the documentation. There were no problems prior to version 9.5.
How can I get the ticket ID?
Thank!

Offline

Board footer

Powered by FluxBB