Last active
August 29, 2015 14:04
-
-
Save rickychilcott/8599a4cba9a05c9b6a62 to your computer and use it in GitHub Desktop.
Parse REST API post in Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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