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
You will need a few items before getting started:
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
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.
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>"
}'
container_id
) and carrier code (carrier_code
) with your own shipment information or use the example data above.