使用 Freshdesk api 创建工单,响应始终为 { "logout": "success" }

Create Ticket using Freshdesk api, response is always { "logout": "success" }

好吧,我已经尝试了 Freshdesk api (http://freshdesk.com/api#create_ticket) 中提到的所有方法来创建新工单,但没有成功,

这是我在 RESTClient 中创建票证的方法:

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

Headers: Content-type:application/json 授权:(使用APIKEY:X的基本授权)

请求Body:

{
  "helpdesk_ticket":{
      "description":"I am not able to create this ticket... bla bla bla",
      "subject":"Urgenta",
      "email":"toma@outerworlda.com",
      "priority":1,
      "status":2
  },
  "cc_emails":"rama@freshdeska.com,diana@freshdeska.com"
}

这是回复:

{
    "logout": "success"
}

我也尝试过使用 curl 命令创建新票证,但结果相似。

您是否在使用任何 restclient 浏览器插件?或者您是否正在使用任何脚本? 我来自 Freshdesk,刚刚尝试分析这个问题,一切看起来都很好,并且能够在您的帐户上使用 API 创建一个票证。

请尝试以下 curl 命令,如果问题仍然存在,请告诉我。 只需将 APIKEY 替换为您在配置文件设置中的 API 密钥。

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": "toma@outerworlda.com", "priority": 1, "status": 2 }, "cc_emails": "rama@freshdeska.com,diana@freshdeska.com" }' -X POST https://milliontech.freshdesk.com/helpdesk/tickets.json

避免这种反应

{
    "logout": "success"
}

并成功创建工单

每次创建新票证时只需清除浏览器的缓存(如果您在 Mozilla 或 Chrome 中使用 RESTClient)

希望这对以后的其他人有帮助,即使在清除缓存后注销成功消息也有问题,也开始出现内部 500 错误,但在咨询 Freshdesk 支持后,这段代码对我有用:

(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\":\"tom@outerspace.com\",\r\n \"priority\":1,\r\n \"status\":2\r\n },\r\n \"cc_emails\":\"youremail@gmail.com\"\r\n}" 
  } 
  $.ajax(settings).done(function (response) { 
    console.log(response); 
  });
}(jQuery))

所以数据值似乎需要以这种方式串起来,我后来不得不修改代码以使用表单,但这对我来说非常有用。