2015-04-06 33 views
1

嗯,我曾嘗試在的Freshdesk API(http://freshdesk.com/api#create_ticket)中提到的每一件事,以創造新的機票,但沒有成功,創建門票使用的Freshdesk API,反應總是{「註銷」:「成功」}

以下是我在RESTClient實現正在做創造票:

Mehtod: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":"[email protected]", 
     "priority":1, 
     "status":2 
    }, 
    "cc_emails":"[email protected],[email protected]" 
} 

這是響應:

{ 
    "logout": "success" 
} 

我也有curl命令試圖建立新票,但在同樣的結果結束了。

回答

2

爲了避免這種情況的響應

{ 
    "logout": "success" 
} 

,創造票成功

只需清除瀏覽器的緩存每次創建新的票證(如果您在Mozilla或Chrome使用RESTClient實現)時

0

您是否使用任何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": "[email protected]", "priority": 1, "status": 2 }, "cc_emails": "[email protected],[email protected]" }' -X POST https://milliontech.freshdesk.com/helpdesk/tickets.json 
+0

感謝ArjunA提供的答案,但它沒有幫助,因爲我已經在我的問題中提到過我已經測試過curl命令來創建票證,當然是使用我自己的APIKEY和我自己的公司URL以及https作爲前綴 – 2015-04-08 04:22:34

+1

我剛纔花了一個小時試圖解決這個相同的問題,然後我發現這個線程!要確認,清除緩存工作。我正在使用Advanced Rest Client Chrome附加組件。瀏覽器似乎將「Cookie」標頭添加到請求中,導致「註銷:成功」響應。從請求中刪除此標頭會導致成功創建標籤。 – 2015-09-06 16:08:26

1

希望這可以幫助其他人在未來,即使在清除緩存後也有註銷成功消息的問題,也開始獲得內部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\":\"[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))

因此,似乎數據值需要以這種方式被串起,我只好再進行修改的代碼形式來工作,但此爲我工作很好。