Hello,
I'm trying to create new ticket via ajax in coffeescript. I keep gettin "Status: 200 OK. Response: "{require_login":true"}" as response, eventhough no ticket was created.
My code:
$scope.sendSupportMail =() ->
data =
'{
"helpdesk_ticket":{
"description":"Test description",
"subject":"Test subject",
"email":"john@doe.com",
"priority":1,
"status":2
}
}'
$.ajax
url: 'https://mycompany.freshdesk.com/helpdesk/tickets.json'
type: 'POST'
contentType: "application/json; charset=utf-8"
dataType: "json"
APIkey: 'here goes the withAppKey'
data: data
success: (data, textStatus, jqXHR) ->
alert( 'Status: ' + jqXHR.status + ' ' + jqXHR.statusText + '. ' + 'Response: ' + jqXHR.responseText )
error:(jqXHR, tranStatus, errorThrown)->
alert( 'Status: ' + jqXHR.status + ' ' + jqXHR.statusText + '. ' + 'Response: ' + jqXHR.responseText )
Situation is the same, when I use username and password. Any idea what could be wrong? Thank you very much for any suggestion.