Tango response classes

Tango API uses standard status codes used in HTTP responses to indicate the result of a request. Status codes focus on communication between users and servers and are essential for your debugging and error handling. We expect you to encounter the following HTTP status codes:

HTTP code responseStatus codeDescription
2xxSuccess2xx responses indicate a successfully completed request.
4xxUser errors4XX errors are related to incorrect requests. These requests should be reviewed and corrected before retrying.
5xxSystem errors5XX errors indicate Tango system cannot fulfill the request. This might be due to temporary issues with one of our suppliers, Tango system, or undetermined internet vagaries. Given the nature of HTTP-over-internet communications, 500 errors are inevitable. We strongly recommend implementing an exponential backoff retry mechanism that retries order requests when a 500 series error is received. Order requests receiving a 5XX error may occasionally process after a network connection is lost. The optional External Reference ID is an idempotent parameter that can be used to ensure duplicate orders are not created.

Other HTTP responses

Other HTTP status code responses include:

HTTP code responseStatus codeDescription
1xxInformational1xx series responses are not implemented at this time and are not expected.
3xxRedirection3xx series responses are not expected and should be reported to Tango immediately.

Response headers

Response headers are HTTP headers that provide additional information about a response to a request. You can provide useful information such as _date _and _requestId _in your response headers. See example below:

{
    "timestamp": "2021-09-20T14:52:56.8Z",
    "requestId": "492fc1a0-ae5b-441b-a12a-ff6c028ceded",
    "path": "/raas/v2/orders",
    "httpCode": 400,
    "httpPhrase": "Bad Request",
    "errors": [
        {
            "path": "utid",
            "code": 400500,
            "i18nKey": "422.024",
            "message": "The Item identifier provided is not valid. Please check the identifier and try again. You can confirm valid Items with the Get Catalog call."
        }
    ]
}

Consider logging the following values for potential error troubleshooting along with the response JSON:

  • referenceOrderID (for successful orders)
  • requestId, httpCode and message (for errors)

📘

Note:

  • JSON is currently the only supported content type for inputs or outputs. It is not required that the requests contain an Accept header, but if they do, it must contain application/json or /.
  • All dates must be represented in a format that is compatible with ISO 8601, for example: 2013-02-21T20:37:07-07:00.
  • Tango can add fields in the Tango API response objects at any time. What you use to un-marshal the JSON responses into native data types must handle unknown fields without failing.

Response handling recommendations

Use i18nKey responses for internationalization (i18n). Standard i18nKey responses are used to design and develop software for international users and provide a unique error code to facilitate international translations. You can use i18n to show localized error messages based on an HTTP code.

Here are the common HTTP codes. Tango is not currently using 1xx and 3xx codes:

HTTP codeDescription
1xxNot implemented; no need for handling
2xxSuccessful
3xxLog response and report to Tango Card
4xxLog response, fix the request, and manually retry
5xxLog response, implement an automated retry mechanism that is capped at 5 requests

For example, if your user gets 404, the UI may display:

  • "Page not found." (English)
  • "página no encontrada." (Spanish)

Error testing in sandbox

Tango has included two items in our sandbox environment that can be used for testing 5XX series errors. Placing an order for these items results in the most common error responses you may encounter in the production account. If you don't see these items in your catalog, contact your Customer Success Manager (CSM) or [email protected]

ItemUTID
Failure Test 1U770618
Failure Test 2U065143

Rewards as a Service™ and the RaaS® API are provided by Tango Card, Inc. © 2024 Tango Card, Inc.