Tango response classes

Tango API expects you to encounter the following HTTP status codes from time-to-time:

ResponseStatus codeDescription
2xxSuccessful2xx responses indicate a successfully completed request.
4xxRequest error4XX errors are related to incorrect requests. These requests should be reviewed and corrected before retrying.
5xxSystem error5XX 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 responses

Other HTTP status codes include:

ResponseDescription
1XX1XX series responses are not implemented at this time and are not expected.
3XX3XX series responses are not expected and should be reported to Tango immediately.

Response headers

Tango response header is where you can provide useful information such as date:

  • date
  • X-REQUEST-ID

πŸ“˜

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 unmarshal the JSON responses into native data types must handle unknown fields without failing.

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

  • For Successful orders: referenceOrderID
  • For Errors: requestId, httpCode and message
{
    "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."
        }
    ]
}

Response handling recommendations

Error responses include an i18nKey which provide a unique error code to facilitate international translations. Here are our response recommendations:

CodeHow to Handle
1xxNot implemented, no need for handling
2xxSuccessful
3xxLog Response & 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

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.