Application Programming Interface

What is an API?

An API is an interface through which different systems, applications and services can communicate with each other. In our daily life, APIs are ubiquitous. In this article, we explain how APIs work and what advantages they offer. We also introduce the different types of APIs and list examples of API use in manufacturing.

Author Editorial team, inray Industriesoftware GmbH
Reading time 8 min

Definition

What does API mean?

An API (application programming interface) is a defined interface through which two software systems exchange data and call each other’s functions.

The term API stands for “Application Programming Interface”.

An API is a collection of definitions, commands and protocols that specify the interaction options with a system, application or service.

An API allows two independent software components to communicate with each other in a predefined way and exchange data (in real time). Because the data exchange only takes place via a defined interface, the remaining program components can remain hidden, which significantly simplifies communication between applications.

APIs are used in a wide variety of areas: the programming interfaces of operating systems such as Windows ensure that programs can be developed and executed for these systems. An ERP system can pass orders and master data to other applications in production via its API. Components of a complex software system also communicate with each other via APIs.

Is every interface an API? No. Every API is an interface, but not every interface is an API: hardware interfaces such as USB or RS485 connect devices physically, whereas an API governs the exchange between pieces of software.

Explanation

How do APIs work?

How an API request works: a dashboard sends a GET request with an API key to the endpoint of a REST API, the server checks the key, processes the request and responds with status code 200 and JSON data on the status, output and scrap of a press

APIs can be implemented in a wide variety of ways (see Types of APIs). Regardless of the implementation, they generally follow a few basic principles:

  • API requests by a client
  • API responses
  • Authentication and authorization
  • API documentation

API requests by a client: Communication via APIs is usually based on a client-server model, in which a client application makes API requests to a server and receives a response from it. The client uses the commands, parameters and endpoints specified by the API to perform actions such as retrieving or changing certain information.

API responses: After processing the request, the server generates a response that is sent back to the client. This response usually contains either the requested data or information about the result of an operation. Data is often transmitted in JSON or XML format.

The diagram shows this process using the example of a dashboard that requests the status of a machine via a REST API.

How an API request works: a dashboard sends a GET request with an API key to the endpoint of a REST API, the server checks the key, processes the request and responds with status code 200 and JSON data on the status, output and scrap of a press

Authentication and authorization: APIs can use security mechanisms such as authentication tokens or API keys to ensure that only authorized applications can access their functions.

API documentation: A good API is usually provided with detailed documentation to help developers understand and use it correctly. This documentation can include information about available endpoints, supported request methods, parameters, expected response formats and possible error codes.

HTTP methods and status codes: With web-based APIs (web APIs), which a web server provides, the HTTP method determines what happens to a resource: GET reads data, POST creates a record, PUT updates it and DELETE removes it. These four basic operations are also known as CRUD. A status code in the server’s response shows whether the request succeeded (e.g. 200 OK) or why it failed (e.g. 401 for missing authorization, 404 for an unknown endpoint).

Classification

Types of APIs

APIs can be differentiated according to various criteria. One of these is their accessibility. Many APIs are only intended for internal communication (private APIs) – within a company or even a single software system.

Other APIs are publicly accessible (public APIs) and in many cases well documented. There are also hybrid models – e.g. APIs that are only made available to customers, business partners or other authorized persons. These are also called partner APIs.

Accessibility

Private, partner and public APIs compared

Who may use an API determines how companies document and secure it. All three types are found in manufacturing:

Private, partner and public APIs compared
Criterion Private API Partner API Public API
Access Internal only, within a company or software system Selected customers, suppliers and business partners after approval Public, usually after registering for an API key
Typical users In-house developers and applications Developers and systems of partner companies Any developer or application
Documentation Internal, often brief Provided to partners Public and usually detailed
Example in manufacturing The MES reads production orders from the company’s own ERP system A supplier reports delivery dates directly to the customer’s plant An online service provides energy prices or weather data

REST, SOAP, RPC and GraphQL

It is also possible to differentiate between APIs according to their architectural style and the protocols used for implementation:

REST

Representational State Transfer (REST) is the leading architectural style in the design of web-based APIs today. It is based on a client-server model, where the client addresses the desired resources using the HTTP protocol. REST defines various criteria that a so-called RESTful API must fulfil, in particular statelessness.
What is REST? (Opens in a new window)

SOAP

SOAP is a network protocol for data exchange between systems. SOAP also defines an approach for setting up an API and describes how data is exchanged, packaged and secured. Protocols such as HTTP, SMTP or FTP can be used for data transfer, while data is represented in XML format.

RPC

RPC stands for Remote Procedure Call. An RPC API provides functions that can be called by a client on remote systems. This approach is mainly used for private APIs. Data can be represented in formats such as XML (XML-RPC) and JSON (JSON-RPC).

GraphQL

GraphQL is a query language and runtime environment for APIs that supports more complex queries. Clients can specifically address multiple resources in one request. They can also become subscribers and be notified of data changes in real time.

Use API communication with manubes

manubes

With manubes, we offer a specialized cloud solution for companies in the manufacturing and processing industries. The platform integrates a wide variety of tools and enables users to create custom applications in areas such as production planning, asset monitoring and process control.

In addition to industrial standard protocols such as OPC UA and MQTT, manubes also uses REST to communicate with online services, devices and other applications. Requests to REST APIs can be integrated into automated workflows, allowing users to efficiently manage their industrial data exchange.

Try manubes for free→
manubes

Why are APIs so important?

Nowadays, APIs are essential for the development of software, the provision of web services and communication between applications. The main advantages of using APIs can be summarized as follows:

Interoperability

APIs allow different applications and systems to interact seamlessly with each other, regardless of their underlying implementation or programming language.

Modularity and reusability

By using APIs, developers can access existing functions and services instead of having to implement them themselves. As a result, more complex applications can increasingly be built from individual services, which brings numerous advantages for maintenance, troubleshooting and scalability.

Ecosystems and partnerships

APIs play a key role in creating ecosystems and partnerships between different companies and platforms. By granting third-party providers or independent developers access to certain resources, companies can expand both the reach and the functionality of their products and services.

Accelerated development and time to market

By giving developers access to ready-made functions and services, APIs significantly speed up the development of software applications.

Industry

APIs in manufacturing

APIs in manufacturing: machines via OPC UA, sensors via MQTT and databases via SQL are connected to manubes through an Edge Node; manubes calls the REST APIs of an ERP system, an AI service and an energy price service and provides freely configured REST access as its own production API for BI tools and a customer portal

In manufacturing, APIs connect machines, business software and cloud services. Two worlds meet here: machines and controllers usually communicate via industrial protocols such as OPC UA or MQTT, while business software such as ERP and MES and online services provide their data and functions via REST APIs. Since version 1.05.04, OPC UA also offers a REST-compatible interface with the OPC UA Web API. Which protocol suits which purpose is explained in MQTT vs. REST vs. OPC UA.

Integration instead of isolated solutions: Integration via APIs enables companies to connect their systems without transferring data by hand. Typical use cases are order data from the ERP system on the shop floor dashboard, production KPIs in reporting, or measured data assessed by an AI service.

manubes connects both worlds: The platform runs in the cloud, connects machines via an Edge Node in the production network and provides connectors for OPC UA servers, MQTT brokers, REST APIs and database systems. Requests to the REST APIs of other systems can be built into automated workflows created in the Workflow Designer – for example to have measured data assessed by an AI service.

Your own production API: Conversely, manubes allows freely configurable REST access. Companies use it to design their own production API and decide which data and functions are visible to other applications – for example open orders for a customer portal or KPIs for a BI tool.

APIs in manufacturing: machines via OPC UA, sensors via MQTT and databases via SQL are connected to manubes through an Edge Node; manubes calls the REST APIs of an ERP system, an AI service and an energy price service and provides freely configured REST access as its own production API for BI tools and a customer portal

Your own production API with manubes

Connect machines via OPC UA and MQTT, integrate ERP systems and online services via REST and configure your own REST access to your production data.

Try it now

What matters for API security

An API opens a system to other applications. In manufacturing, where downtime is expensive, API security is therefore one of the requirements of every integration from the outset. Companies should consider these points:

Authentication

Every request must identify itself, for example with an API key or a token. API keys do not belong in source code or emails but in a protected configuration, and they are renewed regularly.

Encrypted transmission

APIs should only be reachable via HTTPS (TLS) so that data and access keys can neither be read nor altered in transit.

Least-privilege permissions

Each application only receives the rights it needs. A reporting tool may read KPIs but not change orders.

Rate limiting and logging

A limit on requests per period (rate limiting) protects against overload, and a log shows who accessed what and when. An API gateway can handle both centrally.

Keep the production network closed

Machines and controllers should not be directly reachable from the internet. A connection in which data only leaves the production network outbound is more secure – read more in Securely connect production to the cloud.

Examples

5 practical examples of APIs

From machines and business software to cloud services – APIs play a crucial role in networking and interaction between a wide variety of applications and systems in Industry 4.0.

To illustrate this, we look at typical examples of APIs in manufacturing.

Order data from the ERP system

The ERP system provides open production orders via a REST API. A shop floor dashboard retrieves them and shows the shift supervisor which order runs next on which line.

Industrial equipment

Industrial machines and devices can not only provide real-time data via APIs, but also receive operating instructions and parameters. With our cloud platform manubes, such API requests can be automated using workflows.

Shipment tracking in dispatch

Logistics providers such as DHL offer APIs for shipment tracking. The dispatch department takes over the status of outgoing deliveries automatically instead of looking it up on websites.
DHL API catalogue (Opens in a new window)

Energy prices for energy monitoring

Online services provide current electricity prices or weather data via an API. In energy monitoring, they show when energy-intensive processes are cheapest to run.
Energy monitoring (Opens in a new window)

Assessing measured data with AI

A workflow sends equipment data to the API of an AI service and receives an assessment in return – for example to evaluate the performance of a photovoltaic system automatically.

Frequently asked questions about APIs

What is an API in programming?

In programming, an API (application programming interface) is a defined interface through which two software systems exchange data and call each other’s functions. It specifies which commands, endpoints and data formats are available to developers and their tools – for example so that a dashboard can retrieve order data from an ERP system.

What is an API with an example?

A typical example from manufacturing: an ERP system provides open production orders via a REST API. A dashboard sends a request to the API endpoint, the API checks the API key and returns the orders in JSON format. The dashboard then shows the shift supervisor which order runs next.

What is an API used for?

Applications use APIs to retrieve data from other systems, create or change records there and trigger functions without anyone transferring data by hand. This enables the integration of software and cloud services. In manufacturing, an API fetches orders from the ERP system, passes KPIs to reporting or sends measured data to an AI service for assessment.

What is an API key?

An API key is a secret string with which an application identifies itself to an API. The API checks the key with every request and only admits authorized applications. API keys should be treated like passwords: store them securely, do not share them and renew them regularly.

What is the difference between an API and a REST API?

API is the umbrella term for any programming interface. A REST API is an API that follows the REST architectural style: it addresses resources via URLs, uses HTTP methods such as GET and POST and is stateless. REST is the leading style for web-based APIs today.

What is the difference between an API and a webhook?

With an API, the client actively requests data when it needs it. A webhook works the other way round: when an event occurs, the sending system itself calls a previously stored URL and delivers the data. Webhooks suit notifications about events, APIs suit targeted queries and changes.

How are APIs used in manufacturing?

In manufacturing, APIs connect machines, business software and cloud services. Machines usually deliver their data via OPC UA or MQTT, ERP systems and online services via REST APIs. A platform such as manubes brings both together, automates API requests in workflows and provides its own production API through freely configurable REST access.

Product video: Get to know manubes

Try manubes for free

Test the different manubes features in your personal cloud environment.

Get started