Testing Your Integration

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
  • 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.shiparta.com/api_keys
  -H "Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y"

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

{
  "items": [
    {
      "created_at": "2020-10-13T23:05:51.612810",
      "id": 1,
      "is_testing": false,
      "token": "******************11m12y",
      "updated_at": "2020-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.shiparta.com/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": "2020-11-11T20:07:33.930180",
  "id": 526,
  "is_testing": true,
  "token": "PDM6uiqWfhC7Ei8QxcCVh9uY",
  "updated_at": "2020-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.shiparta.com/api_keys
  -H "Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y"

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

{
  "items": [
    {
      "created_at": "2020-11-11T20:07:33.930180",
      "id": 526,
      "is_testing": true,
      "token": "******************Vh9uY",
      "updated_at": "2020-11-11T20:07:33.930180"
    },
    {
      "created_at": "2020-10-13T23:05:51.612810",
      "id": 1,
      "is_testing": false,
      "token": "******************11m12y",
      "updated_at": "2020-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.shiparta.com/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,
  "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.