Reading the OpenAPI Specification File
The OpenAPI specification file contains the following information:
API Information | Description |
Base URL | The base URL is available at servers.url |
Endpoint paths | Endpoints are available under paths , which lists the
path of each API.
|
Request Type | Request type is specified under each endpoint path. |
Request Body | Request body is defined under request type. The
schema for it is defined under
content in requestBody .
|
Parameters | The list of parameters that are needed for an API is defined under each request type. |
Response | The list of expected responses along with response body schemas are defined under each request type. |
The following example shows an OpenAPI specification for an
API:
servers:
- url: https://serverRoot/tmf-api/serviceOrdering/v4.1.0/
paths:
/serviceOrder:
post:
summary: Creates a ServiceOrder
description: This operation creates a ServiceOrder entity.
requestBody:
description: The ServiceOrder to be created
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/ServiceOrder_Create'
required: true
responses:
201:
description: Created
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/ServiceOrder'
400:
description: Bad Request
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Error'
In the above example:
- API Endpoint:
https://serverRoot/tmf-api/serviceOrdering/v4.1.0/serviceOrder
- Request Type:
POST
- Request Body: JSON payload of
ServiceOrder_Create
schema - Responses: 201 and 400 with the response body of schemas
ServiceOrder
andError
respectively.