I have a website who send a push with urban airship. It is run well, but since some weeks it doesn't run . I do different call following the doc I found. each case do the same error 500 or bad request

try 1

{"audience": {"OR":[{"device_token" :"d9afce935c77ea619e4ed6859c2aee0f1011487babd0176bca1048e5c06ae640"}]}, "notification" : { "alert" : "test mg", "ios" : { "badge": "+1","extra" : { "url" : "http://www.urbanairship.com"} }},"device_types":"all"}

Try 2

{"audience": {"OR":[{"device_token" :"d9afce935c77ea619e4ed6859c2aee0f1011487babd0176bca1048e5c06ae640"}]}, "notification" : { "alert" : "test mg", "ios" : { "badge": "+1","extra" : { "url" : "http://www.urbanairship.com"} }},"device_types":["ios"]}

try 3  400 : bad request

{"audience": {"OR":[{"ios_channel" :"d9afce935c77ea619e4ed6859c2aee0f1011487babd0176bca1048e5c06ae640"}]}, "notification" : { "alert" : "test mg", "ios" : { "badge": "+1","extra" : { "url" : "http://www.urbanairship.com"} }},"device_types":["ios"]}

In all cases I use App Key & App Master Secret. Is someone can help me ?






Didn't find what you were looking for?

New post


1 comment

  • Hi Marc,

    To investigate further, would you be able to post your full request including headers and URL, minus the authorization header?

    I've tested your first two payloads, and they seem to work fine on my end (substituting your device token for mine), however your third payload has an error in it. You put the device token where the Channel ID needs to go. Replace the device token with the Channel ID, and that request should work.

    You can find the Channel ID of a device by following this guide: https://support.urbanairship.com/hc/en-us/articles/213491143-How-to-find-a-Device-Identifier-using-Charles-Proxy

    However in your case, since you already have the device token, you can find the Channel ID by putting the Device token in the device lookup section in the GO dashboard. You can find that here: https://go.urbanairship.com/apps/{Your App Key here (minus the brackets)}/device_lookup/

    I would however recommend that you discontinue the use of device tokens to identify a device and instead use the Channel ID, as device tokens can change at any time and Channel ID’s never do. You can learn more about Channel IDs here: https://docs.urbanairship.com/guides/channels/#ios


    Comment actions Permalink

Please sign in to leave a comment.