Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@blotto
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blotto/2f8c546916b6c49320aa to your computer and use it in GitHub Desktop.
Save blotto/2f8c546916b6c49320aa to your computer and use it in GitHub Desktop.
IronMQ example
function postTerm(term) {
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
var data = {
"messages": [
{
"body": term
}
]
};
xhr.open("POST", "http://"+ironIO.config.host+".iron.io/"+ironIO.config.api_version+"/projects/"+
ironIO.config.project_id+"/queues/"+ironIO.config.term_queue_name+"/messages", true)
console.log(data);
//Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/json");
xhr.setRequestHeader("Authorization", "OAuth "+ironIO.config.token);
xhr.send(JSON.stringify(data)); //and forget
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment