Building your integration with Test Mode

To simplify the process of building and maintaining your integration, Arta has implemented a Test Mode Sandbox. Resources created and managed in test mode have no impact on API billing or on the normal functioning of your live mode shipments.

Arta API keys are either “Live” or “Test” keys and they operate exclusively in that mode. The test and live modes function almost identically, with a few key differences:

  • Shipment quote requests in Test mode return quotes where each included service costs 1.00 USD (or equivalent in other currencies)
  • Shipments booked in Test mode do not progress through the operational fulfillment flow

Setting up a test key

Assuming your organization has an existing API key, you can list, create, and manage test keys for the organization. For the purposes of this guide, we’ll assume your organization’s first API key token is s0e1t2e3c4a5s6t7r8o9n10o11m12y.

To retrieve a paginated list of API Keys belonging to your organization, perform the following request:

curl https://api.arta.io/api_keys
  -H "Authorization: Arta_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y"

This will return the list of existing keys which will look something like:

{
  "items": [
    {
      "created_at": "2022-10-13T23:05:51.612810",
      "id": 1,
      "is_testing": false,
      "name": "Store API key",
      "token": "******************11m12y",
      "updated_at": "2022-10-13T23:05:51.612810"
    }
  ],
  "metadata": {
    "page": 1,
    "page_size": 20,
    "total_count": 1
  }
}

The is_testing field indicates whether the key operates on test or live modes. In this case, we have a single live mode API key. We can use it create a new test mode key.

Perform a new API call like this one where the message body includes an api_key object with a value of true for the is_testing property.

curl --location --request POST 'https://api.arta.io/api_keys' \
--header 'Authorization: Arta_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y' \
--data-raw '{
    "api_key": {
        "is_testing": true
    }
}
'

The Arta API will return a response describing the API key resource you have just created:

{
  "created_at": "2022-11-11T20:07:33.930180",
  "id": 526,
  "is_testing": true,
  "name": null,
  "token": "PDM6uiqWfhC7Ei8QxcCVh9uY",
  "updated_at": "2022-11-11T20:07:33.930180"
}

Note that the is_testing property is true. As well, note the token as that can now be used to perform requests against the Arta API to create quote requests, book shipments, and manage notifications in test mode.

If you now repeat the API call to retrieve a paginated list of API keys on your account, you’ll see the newly created resource:

curl https://api.arta.io/api_keys
  -H "Authorization: Arta_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y"

In this case, the Arta API will present the paginated list again:

{
  "items": [
    {
      "created_at": "2022-11-11T20:07:33.930180",
      "id": 526,
      "is_testing": true,
      "name": null,
      "token": "******************Vh9uY",
      "updated_at": "2022-11-11T20:07:33.930180"
    },
    {
      "created_at": "2022-10-13T23:05:51.612810",
      "id": 1,
      "is_testing": false,
      "name": "Store API key",
      "token": "******************11m12y",
      "updated_at": "2022-10-13T23:05:51.612810"
    }
  ],
  "metadata": {
    "page": 1,
    "page_size": 20,
    "total_count": 2
  }
}

The list response obfuscates the actual token for each resource for the sake of security, but you can retrieve the token by fetching the individual resource directly:

curl https://api.arta.io/api_keys/526
  -H "Authorization: Arta_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y"

The Arta API will now present the full token string for the API Key resource.

{
  "created_at": "2020-11-11T20:07:33.930180",
  "id": 526,
  "is_testing": true,
  "name": null,
  "token": "PDM6uiqWfhC7Ei8QxcCVh9uY",
  "updated_at": "2020-11-11T20:07:33.930180"
}

You can view the full list of API endpoints for managing API Keys in our API reference docs.