API Issues with ticket creation

  • 3 April 2017
  • 1 reply
  • 16 views


I've been working on a ticket creation script in perl. I have had it partially working where it will create a very basic ticket. However tonight when I've been working on it, it appears that no matter what I do, I'm getting 500 server errors. I've commented out all the additions I made and still get the 500 errors.




I just tried a couple of calls using CURL with an example create ticket call, and even with that I'm getting a 500 server error. Here is the call I used:-




curl -u <APIKEY>:test -H "Content-Type: application/json" "helpdesk_ticket": { "description": "Test Ticket", "subject": "Test Ticket - Ignore", "email": "myemail@address.com", "priority": 1, "status": 2 }' -X POST https://realdomainname.freshservice.com/helpdesk/tickets.json -v






I removed personal/company information from the above example for security purposes.




* upload completely sent off: 146 out of 146 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/html; charset=utf-8
< Date: Mon, 03 Apr 2017 03:49:18 GMT
< Status: 500 Internal Server Error
< X-Rack-Cache: invalidate, pass
< X-Request-Id: c8b5b6f4252c04880313a6095b69eb3e
< X-Runtime: 0.002764
< Content-Length: 38006
< Connection: keep-alive







This topic has been closed for comments

1 reply


Hi Hugh,

Please try the api mentioned below.

curl -u <API key>:X -H "Content-Type: application/json" -d '{ "helpdesk_ticket": { "description": "Details about the issue...", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2 }, "cc_emails": "ram@freshservice.com,diana@freshservice.com" }' -X POST https://<URL>.freshservice.com/helpdesk/tickets.json

Here the difference is

curl -u user@yourcompany.com:test

curl -u apikey:X -H


This is the difference when you use the username/password and the api key.

Hope this helps.


Regards


Jayesh


Freshservice support