|The Urban Airship API uses common HTTP response status codes to provide information about the requests that were sent.|
When an API call returns an error code, the response usually includes more information than just the error code. You can include verbose output from command line tools(like cURL) by adding the option -v (for verbose) to your commands to help get more information for troubleshooting.
Common status codes:
- 200/202 OK/Accepted - A 200 or 202 OK/Accepted message simply means that your API call was properly formatted and not initially rejected. A 200 or 202 response message does not imply that a push notification will be sent. Other problems may prevent the notification from being sent. Example: The audience in the request didn't contain an active device. Or Apple/Google rejected the delivery.
- 201 Created - The API request is valid and created something like a Tag (as opposed to updating an existing resource).
- 204 Deleted - Like 201 Created, but means the resource was successfully deleted.
- 301 Moved Permanently - Redirect to another URL. Chances are the trailing slash on the request is missing.
- 400 Bad Request - The request failed. Most likely something was formatted improperly. The body of the response should give a hint as to what went wrong, but if it doesn't, the Content-Type in the header may be missing, or the body was invalid JSON.
- 401 Unauthorized - No access credentials were supplied, or they are either incorrect or insufficient for the call. Double check the App Key and App Secret, and check to see if the API call requires the App Master Secret.
- 404 Not Found - The URL sent in the request does not exist.
- 405 Method Not Allowed - The type of HTTP request attempted is not allowed. For example, there may be a PUT to a URL that only supports GETs. The list of valid methods is in the response headers. One common case for 405s is that a PUT or POST sent to a URL without the trailing slash received a 301 redirect response. The HTTP library then followed the redirect but sent a GET without data.
- 406 Not Acceptable – The request could not be satisfied because the requested API version is not available.
- 5XX Internal Error - Something broke on our end. On the occasion that a 5XX status is received, retrying the request is the best course of action to take. If a request continues to fail with a 5XX status, you can check the Urban Airship Status Page to check the operational status of our systems. Also see Best practices for 500 and 503 API errors. If, afterwards, you are still experiencing problems you can open a support ticket or ask in our Forum.