Skip to content

Instantly share code, notes, and snippets.

@dpawluk
Created March 13, 2014 22:30
Show Gist options
  • Save dpawluk/9538469 to your computer and use it in GitHub Desktop.
Save dpawluk/9538469 to your computer and use it in GitHub Desktop.
JSON.stringify() is important. Sending a JSON object will result in automatic conversion to form/url-encoded key-value pairs.
requests: {
var json_data = {
"ticket": {
"subject": "Hello",
"comment": {
"body": "Some question"
},
"ticket_form_id": this.carrierOpsFormId,
"custom_fields": [{
"id": 23810968,
"value": "custom value"
}]
}
};
addTicket: function(json_data) {
return {
url: '/api/v2/tickets',
type: 'POST',
dataType: 'json',
proxy_v2: true,
contentType: 'application/json',
data: JSON.stringify(json_data)
};
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment