【问题标题】:Create Ticket using Freshdesk api, response is always { "logout": "success" }使用 Freshdesk api 创建工单,响应总是 { "logout": "success" }
【发布时间】:2015-04-06 11:17:08
【问题描述】:

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

这是我在 RESTClient 中创建票证的操作:

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

标题: 内容类型:应用程序/json 授权:(使用API​​KEY的基本授权:X)

请求正文:

{
  "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 命令创建新票,但结果相似。

【问题讨论】:

    标签: jquery json logout freshdesk


    【解决方案1】:

    为了避免这种反应

    {
        "logout": "success"
    }
    

    并成功创建工单

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

    【讨论】:

      【解决方案2】:

      希望这对将来的其他人有所帮助,即使在清除缓存后也出现注销成功消息的问题,也开始出现内部 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))

      所以看起来数据值需要以这种方式进行字符串化,我必须稍后修改代码才能使用表单,但这对我来说非常有用。

      【讨论】:

        【解决方案3】:

        您是否使用任何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
        

        【讨论】:

        • 感谢 ArjunA 的回答,但这并没有帮助,因为我已经在我的问题中提到我已经测试 curl 命令来创建票证,当然是使用我自己的 APIKEY 和我自己的公司网址,以 https 为前缀
        • 我花了一个小时试图解决同样的问题,然后才找到这个帖子!为了确认,清除缓存有效。我正在使用 Advanced Rest Client Chrome 插件。浏览器似乎将“Cookie”标头添加到导致logout: success 响应的请求中。从请求中删除此标头会成功创建票证。
        猜你喜欢
        • 2015-07-06
        • 1970-01-01
        • 2019-02-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-06-18
        相关资源
        最近更新 更多