Guide

What is an API and how does it work in B2B?

Learn how two applications use an API to communicate, with a B2B portal example for tracking deliveries.

An API is an interface that lets an application use data or functions from other software. For example, a distributor’s portal can check a shipment’s status in a carrier’s system. The portal identifies the shipment and uses the response to update the customer.

What is an API used for?

API stands for application programming interface. The software that exposes the interface defines the available operations, required inputs and expected responses. The software that calls the API follows this contract to retrieve information or trigger an action.

A business can use an API to check product availability, create a transport request or synchronise data between tools. For recurring business documents, compare the uses of EDI and APIs when choosing an exchange method. Compare EDI and APIs

How does an HTTP API call work?

With an HTTP API, the client application sends a request to the address for that operation. The request specifies a method. For example, GET requests a representation of the identified resource, such as data about a shipment. Depending on the service, the request also includes an identifier and authentication information.

The server sends a response. The status code indicates the HTTP result, and the body may contain data or explain what happened. For example, an API might return JSON if its contract specifies it. The client uses this information to decide what to display or do next. HTTP specification (RFC 9110) · OpenAPI Specification

Example: using an API to track a delivery

  1. The customer opens their order. The portal finds the carrier’s shipment ID and checks that the customer is authorised to view that order.
  2. The portal queries the carrier. It sends the identifier specified by the API contract and requests the latest status.
  3. The portal handles the response. For example, it displays “Out for delivery” with the time of the update. If the service is unavailable, it explains that it cannot display the latest status.

Before connecting the systems, agree how to handle references the carrier does not recognise. Check whether both systems use the same time zone and how to display information that has not been updated since the last exchange.

How do you read API documentation?

  • Operations. Check which actions are supported and which address to call for each one.
  • Data. Note the required fields, their formats and possible response values.
  • Access. Identify the authentication method, required permissions and test environment.
  • Errors and changes. Review response codes, rate limits and versioning rules.

When does API management make sense?

When several internal applications or partners use your APIs, centralise the rules you need to enforce and monitor. An API management solution can publish documentation, apply access and rate limit rules, and monitor calls. In a delivery tracking project, this monitoring helps identify the partner or operation involved if a series of requests fails. Azure API Management documentation

In summary

For your first integration, choose a useful piece of data to display, identify the system that holds it and test normal responses and errors. Your team can then decide how to manage interface documentation, access and monitoring.