Skip to content

Instantly share code, notes, and snippets.

@rickychilcott
Last active August 29, 2015 14:04
Show Gist options
  • Save rickychilcott/8599a4cba9a05c9b6a62 to your computer and use it in GitHub Desktop.
Save rickychilcott/8599a4cba9a05c9b6a62 to your computer and use it in GitHub Desktop.
Parse REST API post in Javascript
PARSE_APPLICATION_ID = 123456789;
PARSE_REST_API_KEY = 123456789;
var messageText = "canned alert";
var parseMessage = {
"channels": "",
"type": "ios",
"expiration_interval": 86400,
"data": {
"alert": messageText,
"badge": 0,
"sound": ""
}
};
var parseAPIHeaders = {
'X-Parse-Application-Id': PARSE_APPLICATION_ID,
'X-Parse-REST-API-Key': PARSE_REST_API_KEY
};
$.ajax({
type: 'POST',
headers: parseAPIHeaders,
url: "https://api.parse.com/1/push",
data: JSON.stringify(parseMessage),
contentType: "application/json"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment