BY THIS CODE PLEAS HELP HOW TO CREATE ZENDESK TICKET
<script type = "text/javascript" >
$(function() {
$("#btnGet").click(function() {
$.ajax({
url: 'https://xxxx.zendesk.com/api/v2/tickets/1.json',
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({
"ticket": {
"subject": "Tst SUB",
"comment": {
"body": "Test BODY"
}
}
}),
success: function(response) {
alert("Hello: Success");
},
failure: function(response) {
alert("Fail");
},
error: function(response) {
alert("Error");
}
});
});
});
</script>
2
Answers
It appears that you have some issues with the body section.
try
Your code works, the only mistake is in the request url. When creating a new ticket you don’t need to add any ticket number.
Just edit the url removing
1.json
and leave'https://xxxx.zendesk.com/api/v2/tickets'
Also, if you’re not sending the request from within Zendesk (e.g. a custom app) you need to authenticate the request.