1
votes

Well, I have tried every thing mentioned in Freshdesk api (http://freshdesk.com/api#create_ticket) to create new ticket but with no success,

Here is what I am doing in RESTClient to create ticket:

Mehtod: POST URL:https://milliontech.freshdesk.com/helpdesk/tickets.json

Headers: Content-type:application/json Authorization:(Basic Authorization using APIKEY:X)

Request Body:

{
  "helpdesk_ticket":{
      "description":"I am not able to create this ticket... bla bla bla",
      "subject":"Urgenta",
      "email":"[email protected]",
      "priority":1,
      "status":2
  },
  "cc_emails":"[email protected],[email protected]"
}

And this is the response:

{
    "logout": "success"
}

I have also tried with curl command to create new ticket but ended up in the similar result.

3

3 Answers

2
votes

To avoid this response

{
    "logout": "success"
}

and create ticket successfully

Just clear your browser's cache every time you create new ticket (If you are using RESTClient in Mozilla or Chrome)

1
votes

Hope this helps others in the future, had issues with the logout success message even after clearing cache, also started getting an internal 500 error, but after consulting Freshdesk support this code worked for me:

(function($){ 
  var settings = { 
    "async": true, 
    "crossDomain": true, 
    "url": "https://company.freshdesk.com/helpdesk/tickets.json", 
    "type": "POST", 
    "headers": { "authorization": "BasicAuthKey", "Content-Type": "application/json" }, 
    "data": "{\r\n \"helpdesk_ticket\":{\r\n \"description\":\"Some details on the issue ...\",\r\n \"subject\":\"Support needed..\",\r\n \"email\":\"[email protected]\",\r\n \"priority\":1,\r\n \"status\":2\r\n },\r\n \"cc_emails\":\"[email protected]\"\r\n}" 
  } 
  $.ajax(settings).done(function (response) { 
    console.log(response); 
  });
}(jQuery))

So it seems the data value needs to be stringed in that way, I had to modify the code later to work with a form but this worked great for me.

0
votes

Are you using any restclient browser add on? Or is there any script that you are using? I am from Freshdesk and just tried to analyzing this issue and everything looked fine and was able to create a ticket using API on your account.

Please try out the below curl command and let me know if the issue still persists. Just replace the APIKEY with your API Key from Profile Settings.

curl -u APIKEY:X -H "Content-Type: application/json" -d '{ "helpdesk_ticket": { "description": "I am not able to create this ticket... bla bla bla", "subject": "Urgenta", "email": "[email protected]", "priority": 1, "status": 2 }, "cc_emails": "[email protected],[email protected]" }' -X POST https://milliontech.freshdesk.com/helpdesk/tickets.json