Skip to content

OPC UA and OpenAPI

    The 1.05.04 version of the specification introduced the OpenAPI definitions for OPC UA. OpenAPI is a specification for defining and documenting RESTful APIs. It provides a standard, machine-readable format for describing the structure, operations, and capabilities of an API. It allows both humans and computers to understand the API’s functionalities, which will make it easier to build OPC UA applications. The official OpenAPI definitions for OPC UA is found here. A definition that only includes services which can be invoked without creating a session is found here.

    The OPC UA OpenAPI definition introduces a number of simplifications that users will find helpful including:

    • NodeIds and QualifiedNames are now JSON strings using a syntax defined in Part 6;
    • Context dependent namespace indexes are no longer used;
    • User authentication uses the HTTPS authorization header which follows OpenAPI conventions;
    • Communication with web-friendly protocols such HTTPS or WebSockets;
    • Support for GZIP encoded messages.

    Tools such has the OpenAPI Generator can be used to create development environment specific client APIs that can be used to access an OPC UA server without the need for a purpose-built SDK. The OPC Foundation now has repositories for pre-generated OpenAPI client libraries for different development environments including .NET, Python and TypeScript (NodeJS). These libraries include constant declarations for all BrowseNames, StatusCodes and NodeIds defined in the OPC UA specification.

    The Opc.Ua.ModelCompiler has also been updated to produce the same constant declarations from any UANodeSet.

    A web-based OPC UA server is now live with an API definition page (note that the API definition includes links to the OPC UA Online Reference for every defined type). The code used to build the OPC UA server is part of the UA-WebApi-StarterKit. This repository includes simple clients written using the OpenAPI client libraries.

    The OPC UA WebApi is designed for web-based servers and aggregators that provide a front end to OPC UA servers that support the OPC UA binary protocol. With these aggregators, clients built with the OpenAPI client libraries will be able to access any OPC UA server.