When making API requests, it is possible to receive an error even though your request actually completed successfully.

For example, if you submit an API request and it times out, you can’t be sure whether your request was received by CleverFox Backup, or not.

If you simply re-try the request, you might end up with a duplicate transaction.

Uniqueness Token

In order to prevent these duplicates, CleverFox Backup allows you to supply a “token” in any POST or PUT request.

The value you supply for the “token” should be long and random, like a GUID. The exact format of the value is up to you, but the maximum size is 50.

If a subsequent request with the same “token” is received within 60 minutes, it will be rejected with a 409 Conflict response code and a duplicate error message.

For example, suppose you are updating a Company. You send the following POST request, including a “token”.

    "PartnerId": null,
    "PlanTypeId": 1,
    "Name": "Patrick V. McNamara Federal Building",
    "AddressLine1": "477 Michigan Ave",
    "AddressLine2": null,
    "CityMunicipality": "Detroit",
    "StateProvidence": "MI",
    "PostalCode": "48226",
    "Country": "US",
    "Phone": null,
    "IsInactive": false,
    "Token": "1114652B-3AC4-4A99-8E82-459810299373"

After you send your request, there is some problem, and the request times out without a valid response instead of the 201 Created you were hoping for.

Since you have supplied a “token”, you can safely re-try the request.

If you receive the expected 201 Created response, you can continue as usual knowing that CleverFox Backup never received your first request.

If you receive a 409 Conflict and a duplicate error message for the retry, then you know that the first request was received and processed.