Responses

Success and error responses typically conform to the following formats.

Error response

Errors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.

Jump to examples ↓

OBJECT PROPERTIES
  • details object

    Provides information relating to the specific error_code when possible. For 400 errors, this object may include the path and location of validation failures.

    OBJECT PROPERTIES
    • error string

      Specific information about the semantic error, helping you better understand why the request failed.

    • location object

      The specific line and column where the validation error occurred, if known.

      OBJECT PROPERTIES
      • column integer

        The column containing the semantic error.

      • line integer

        The line containing the semantic error.

    • path string

      The path to the key containing the validation error.

  • error stringREQUIRED

    A plain-text explanation of the error.

  • error_code integer

    The Airship error code. This is normally the HTTP error code appended with a 2-digit identifier, helping provide more specific details about the error.

  • ok booleanREQUIRED

    2xx responses return true; 4xx responses return false.

Used in:

Examples

400 response

{
  "ok" : false,
  "error" : "Could not parse request body.",
  "error_code" : 40000,
  "details" : {
      "error" : "The key 'alert1' is not allowed in this context",
      "path" : "notification.alert1",
      "location" : {
          "line" : 5,
          "column" : 18
      }
  }

400 response without location

{
    "ok": false,
    "error": "Could not parse request body.",
    "error_code": 40902,
    "details": {
        "error": "malformed sender"
    }
}

404 response

{
    "ok": false,
    "error": "Entity not found",
    "error_code": 40401
}

OK response

Returned with 2xx Responses. At a minimum, successful calls return true for the ok key. If your call includes a verbose response (as with GET requests, etc.), the ok key will appear in the top-most object, outside the verbose response.

Jump to examples ↓

OBJECT PROPERTIES
  • ok booleanREQUIRED

    Success.

  • operation_id string

    A unique string identifying the operations that modify resources. Use the operation ID to locate and track grouped operations (i.e., a batch push operation may generate multiple push_id strings, but a single operation_id) or operations that change an existing resource.

Used in:

Examples

OK response

HTTP/1.1 202 Accepted
Content-Type: application/vnd.urbanairship+json; version=3

{
    "ok": true,
}

OK with identifiers

HTTP/1.1 202 Accepted
Data-Attribute: push_ids
Content-Type: application/vnd.urbanairship+json; version=3

{
    "ok": true,
    "operation_id": "df6a6b50-9843-0304-d5a5-743f246a4946",
    "push_ids": [
        "9d78a53b-b16a-c58f-b78d-181d5e242078"
    ]
}