products versions - webMethods Integration Server version: 10.7 and above
Overview
The OpenAPI Specification (OAS) is an API description format for the REST APIs.
The OpenAPI Specification is widely accepted by the industry and is used by millions of developers and organizations for developing their APIs, be it internal or client-facing.
Generally, OpenAPI definitions are in YAML or JSON.
Use Cases
How to build an OpenAPI request?
Consider the use case where the provider shares the OpenAPI document, and the consumer wants to invoke the REST API that the provider exposes. The consumer needs to build an OpenAPI request using the OpenAPI document.
The use case starts when the provider sends the OpenAPI document that is ready for consumption and ends when the consumer receives the successful response of the API.
Actors
- A client that invokes the REST API.
- Integration server that acts as a service provider.
Pre-requisite
- The consumer must have an OpenAPI document from the provider to invoke the REST APIs.
Basic Workflow
- From the OpenAPI document, identify the APIs that you want to invoke.
- Identify the server details from the element, which specifies the hosted services. The server details can either be specific to the operation that you want to invoke or common across all the APIs defined in the OpenAPI document.
- Use any REST client.
-
Build the REST API request in the following format:
Format Element in the OpenAPI document <URL_of_the_API_server>/<resource_path> <servers.url>/ Example, “http://127.0.0.1:5555/pet/findByStatus”
-
In the Rest request, set the HTTP method to be used.
-
Set the path parameters, query string, and header parameters for the REST API as defined in the OpenAPI document. For more information, see Building Request Parameters.
-
If the REST API defines a requestBody, add the request body and set the Media Type as defined in the OpenAPI document for the API as a content-type header. For more information, see Building Request Bodies.
-
If the REST API defines a response, set the Media Type as defined in the OpenAPI document for the API as an accept header.
-
Set the authentication type for the API as defined in the OpenAPI document.
Post-conditions
- The REST client must receive the response for the API as defined in the OpenAPI document.