API Troubleshooting Guide

This article will help you troubleshoot some common issues you might encounter when using the Urban Airship API. Please see the API Resources in our documentation for more information.

 

Q: I got a 202 response for my API push request, but I didn't receive the push. What did I do wrong?

A:
A 202 or 200 API response code means that your API request was formatted correctly and accepted as a syntactically valid API call. A valid API call does not always mean that a resulting push would be sent. There are many possible reasons, the most common being:

  1. You may have sent a push to a tag or segment that's not associated with any devices.
  2. You may have pushed to a Channel ID, Named User or Alias that is not opted in or installed.

We check these later in our processing of the push, not as part of our initial validation. The initial validation of the request (and the response you get) only pertains to whether your request was properly authenticated and formatted. 

See our Troubleshooting Guide for more information on why your push may not have arrived as expected.


Q: Why is my API request coming back as 401 (unauthorized)?

A:
A 401 error from our API means that the authentication portion of your request was invalid.  Please make sure that you are not authenticating with the wrong set of App Key and Secret. Push requests and many other API requests require your App Key and Master Secret for authentication, while others only require your App Key and App Secret.

In the API documentation for a given request, you should see something like this:

POST /api/push HTTP/1.1
Authorization: Basic <master authorization string>
Content-Type: application/json
Accept: application/vnd.urbanairship+json; version=3;

If the Authorization: includes <application authorization string> use your App Key and App Secret.

If the Authorization: includes <master authorization string> use your App Key and Master Secret.

Q: I am getting another strange API response code, what does it mean?

A: 
Please see our documentation about the various HTTP Response Codes.

Q: I pushed successfully using the API, but the push doesn't show up in the Messages history.

A: 
API initiated pushes are not listed in the Messages history in our web dashboard . Messages sent through the API are listed in the Activity Log with the exception of Unicast and Automated messages. 
 
Q: I got the error "(400) Bad Request. iOS payload, but nothing to deliver to (missing device_tokens, tags, segments, or aliases)", but I'm sending a valid API v3 payload. What's wrong?

A: Make sure you are including both of the necessary headers to push to API v3, or else the API will think you are trying to match the formatting of the older API. These headers are:

  • Content-type: application/json
  • Accept: application/vnd.urbanairship+json; version=3;

 

Related Content: