How should i post data to urban airship so it works correctly? I’ve tried this, but get error that i havent posted any data
<form enctype="application/json" method="POST" action="https://go.urbanairship.com/api/push/broadcast/">
<input type="hidden" name="username" value="my_app_key"/>
<input type="hidden" name="password" value="my_master_secret"/>
<input type="hidden" name="data" value='{
"aps": {
"badge": 15,
"alert": "Hello from Urban Airship!",
"sound": "cat.caf"
},
"exclude_tokens": [
]
}'/>
<button type="submit"/>
</form>
Browsers generally only support enctype “application/x-www-form-urlencoded” and “multipart/form-data”. What’s probably happening here is the form is not posting valid JSON, but instead url-encoded data where on of the keys is ‘data’ and the value is the long string of JSON.
Your best bet would be to call a javascript function when you press the submit button which posts the data with proper content-type and formatting. Using something like JQuery.post() http://api.jquery.com/jQuery.post/ would be pretty helpful.