This tutorial will walk through using the container tracking API to subscribe to a container and receive location updates. You will make use of the command line and cURL to access the API, which is the default language selected in the Vizion API reference.

Programming language selection in API reference

Programming language selection in API reference

Getting started

You will need a few items before getting started:

Create a callback URL

Vizion's container tracking API is designed to provide realtime data updates to you through webhooks, eliminating the need to manually check for changes at regular intervals. Vizion will send these updates directly to the callback URL you provide.

<aside> 💡 If your use case is better suited for a polling method, you have the option to exclude the callback URL when subscribing to a container. Instead, you can utilize a GET request for List Reference Updates, which will retrieve a list of Update Payloads specific to the provided reference ID.

</aside>

To demonstrate the functionality of the Vizion API first before pointing to a URL on your server, you can use Webhook.site to create a temporary endpoint to use as your callback URL. Go to webhook.site and copy the URL generated for you.

Webhook.site unique URL

Webhook.site unique URL

Make an API request to create a reference

For this tutorial, the Create a reference via Carrier Code endpoint will be used. You can explore other available options by referring to the Choose an endpoint to track containers guide.

  1. Using the cURL request below, replace callback_url with your webhook.site URL and YOUR_API_KEY_HERE with your Vizion API key.
curl --location '<https://prod.vizionapi.com/references>' \\
--header 'X-API-Key: YOUR_API_KEY_HERE' \\
--header 'Content-Type: application/json' \\
--data '{
    "container_id": "MEDU8381210",
    "carrier_code": "MSCU",
    "callback_url": "<https://webhook.site/77b4a124-7fa3-4cfa-989b-5e7c8740e1df>"
}'
  1. Replace the container ID (container_id) and carrier code (carrier_code) with your own shipment information or use the example data above.
  2. Open your terminal, paste the complete cURL request, and press Enter.
  3. You will see a response indicating that the request was successful with information about the reference created.