API and Webhooks

Updated May 9, 2023

The API has great flexibility and various possible uses for business applications.  With its increased popularity in the industry, and the ability to meet customized needs, you can save time and money – and innovate faster.

They key to getting ahead, is getting started.

keyboard, key, success

How to Leverage the API

APIs are a hot topic that everyone seems to be talking about. As a concept, it’s exciting, but when it comes to understanding how to leverage an API for business purposes, it can be confusing. To help demystify the API, we’ve tapped our integrations team to share insights and examples of how shippers and delivery companies leverage the API right now.

What is an API and how can it benefit my business?

  • Think of an API like a menu in a restaurant. The menu provides a list of dishes you can order, along with a description of each dish. When you specify what menu items you want, the restaurant’s kitchen does the work and provides you with the finished dishes.
  • Allows for faster innovation, reducing development barriers
  • Enables quicker movement into new business opportunities
  • Makes it easier for trading partners to integrate
  • Saves time and resources, when consumed with reusable automations for future development

Examples of how an API can be used to integrate

  • Create, read, update and delete driver records from a Driver Management Solution
  • Receive shipments from trading partners
  • Retrieve business intelligence data with third-party tools
  • Connect separate data sets to unity information across all your business applications (pulling together otherwise unconnected data)

Thinking of using the API? Here are a few questions to ask…

  • Do you or your trading partner have developers who can complete the technical pieces of the integration?
  • Have you or your developer read through the documentation, to know what you’ll need to get started?
  • What operational connection do you want to achieve? Or what challenge are you trying to solve?

Example: Using the API to Create Orders in 5 Easy Steps

Easy is relative, right? Trust us, while interacting with an API sounds complicated, for developers, using an API to create orders and integrate with trading partners is straightforward and easy to implement. We’re here to help your developers understand and use our API –  below are a few steps to get started! Our full technical documentation is available here.

Did you know

Trading partners can use the API to create shipments, track shipments, get ETAs, driver, request driver locations, and much more​

The API has a wide range of possible uses, and various tools can be used. For this walkthrough we’ll use the documentation UI portal to create an order. Although this documentation UI portal would not typically be used to interface with the API for a completed integration solution, it can be used for development and testing.

Navigate to the Appropriate URL​

Each CXT Software customer has their own dedicated documentation UI portal URL. Not sure what it is? See the Getting Started section of our documentation here.

Once you have the right URL, the web page should look something like this:

Auth Tokens

Authorization tokens are provided as a result of authentication (providing user/password credentials, in order to interact with the database). Authentication is based on user-types, depending on which action needs to be taken with the API. For more details, see the Authenticate section of our documentation here.

To create an order, authenticate using an “Internet User” type.

Auth Token Field

Add the authorization token to the field at the top of the webpage.

See detail here regarding valid authentication duration, for each user type.

Locate the POST endpoint called “/v1/Orders”

You can find this endpoint under the “Orders” and “Supported” sections.

Similar to how authentication was achieved, expand the v1/Orders row to interact with the API endpoint for creating a new on demand order.  Single click, to populate the “Model Schema” into the “orderRequest” box, and replace the schema values with your order details.

Here’s an example, with basic and required order fields (the bold values represent sample data)

{
   “order”: {
      “custId”: 1,
      “readyTimeFrom”: 1594836000000,
      “orderType”: 5050,
      “origin”: {
         “name”: “Mystery Castle“,
         “address1”: “800 E Mineral Rd“,
         “city”: “Phoenix“,
         “state”: “AZ“,
         “zip”: “85042“,
   },
      “destination”: {
         “name”: “Tlaquepaque Arts & Shopping Village“,
         “address1”: “336 AZ-179“,
         “city”: “Sedona“,
         “state”: “AZ“,
         “zip”: “86336“,
      }
}
}

Tech Tip: Dates should be entered in milliseconds (in UTC time) for JSON requests. In the above example, 1594836000000 converts to Jul 15 2020 18:00:00 UTC (11:00:00 Pacific Time).​

Click “Try it out!” to create the order

If the post is successful, the Response body will contain your order number.

Webhooks

Webhooks are used by the operations app to provide integration/trading partners or other third-party applications with real-time details based on status events such as picked up or delivered. Typical APIs require third-parties to regularly poll your system for updates while webhooks save time and resources by making the constant polling unnecessary. More information can be found in our documentation.

The webhook functionality is available in a basic or advanced configurations.

Basic Webhooks

A basic webhook sends a pre-determined set of basic data from your system to a third-party system when a status event occurs (such as picked up or delivered). For example, this could be sending an update from your system to your trading partner when you’ve completed a pickup or delivery for one of their orders. Because this notification may not provide enough information, trading partners will likely prefer to request a full order update from the API as a follow up call for more information.

Examples of When to Use Webhooks

  • For primary order status events (such as confirmed, at pickup, picked up, delivered, etc.), basic data includes the order ID, current timestamp, and any date/time stamps for that job (if captured by the driver at the time of transmission)
  • For additional order status events (such as canceled, invoiced, driver assigned, status code added, etc.), basic data includes the order ID, event type, and current timestamp
  • For address change status events, basic data includes the order ID, current timestamp, and address information
  • For primary route stop status events (such as arrived, completed, signature, etc.), basic data includes the route stop ID, current timestamp, and any date/time stamps for that job (if captured by the driver at the time of transmission)
  • For additional route stop status events (such as consolidated, deactivated, status code added, etc.), basic data includes the route stop ID, event type, and current timestamp

Advanced Webhooks

An advanced webhook is similar to a basic webhook, but with customization options for the information included when a status event occurs. If the pre-determined set of details from the basic webhook does not provide the trading partner with the information they need (or they are not able to make a follow up API call to get more info, and prefer to accept web posts) the details sent via the webhook can be expanded using the advanced webhooks to provide more information in real-time.

Read Worthy Articles​

For more extensive walkthroughs and comprehensive information, check out our knowledge base!

Our web service allows for consistent integrations and services, making it easier for third parties to integrate with the Operations App. It is accessible by both REST and SOAP and accepts both XML and JSON requests. Read more...

Our webhooks are used to provide integration/trading partners or other third-party applications with real-time details based on status events such as picked up or delivered. Read more...

Checkpoint

Test your API knowledge with this checkpoint.

Click the “View Questions” button when finished to see additional detail about each question and answer.

THANKS FOR VISITING!

Before you go, tell us about your experience.

Don’t forget, you can sign up for a sneak peak!

Try It Now

Sneak a peek at the
great training material available

If you didn’t find what you were looking for, please send us a message here.

Company Subscription Status