Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Interacting with the OpenShift Lightspeed REST API
As a developer or administrator, you can use the OpenShift Lightspeed REST API to programmatically interact with the service. The REST API is the only supported and stable interface for OpenShift Lightspeed.
3.1. OpenShift Lightspeed REST API specifications Copia collegamentoCollegamento copiato negli appunti!
Use the OpenAPI 3.1 specifications for OpenShift Lightspeed to access interactive REST API documentation and download machine-readable files for environment integration.
The OpenShift Lightspeed REST API utilizes OpenAPI 3.1 specifications. The system automatically generates the specification from the route definitions, and you do not need to manually configure separate specification files.
Do not expose the OpenShift Lightspeed service directly to the public internet without enabling authentication. In a production OpenShift Container Platform environment, ensure that you use kube-rbac-proxy to front the service for authentication.
You can access the following API endpoints when the service is running locally on port 8080:
-
GET /docs: The interactive Swagger UI API explorer. -
GET /redoc: The ReDoc three-panel responsive documentation. -
GET /openapi.json: The raw, machine-readable OpenAPI JSON file.
Restrict network-level access in production environments to prevent the interactive /docs and /redoc endpoints from being publicly accessible.
3.2. Exploring the REST API by using the Swagger UI Copia collegamentoCollegamento copiato negli appunti!
The interactive Swagger UI provides a platform to explore and test OpenShift Lightspeed REST API endpoints. You can use this interface to verify request parameters and response schemas directly from your browser to ensure seamless API integration.
You can explore and test the OpenShift Lightspeed REST API endpoints by using the interactive Swagger UI.
Prerequisites
- The OpenShift Lightspeed service is running.
Procedure
-
Open a web browser and navigate to
http://localhost:8080/docs. - Expand any endpoint tag to view its parameters, request body schema, and possible response codes.
Click Try it out to send live requests directly from your browser.
NoteIf authentication is enabled, you must provide a valid
Bearertoken by clicking Authorize before sending requests. Unauthenticated requests return401or403status codes.
3.3. Regenerate the OpenAPI schema Copia collegamentoCollegamento copiato negli appunti!
Regenerating the OpenAPI schema updates the docs/openapi.json file to reflect recent development changes. Keeping the schema current prevents documentation drift and ensures that integration tests accurately validate the API.
The canonical, version-controlled representation of the API surface is located in the docs/openapi.json file. If you make any route, model, or version changes during development, you must regenerate the OpenAPI schema to prevent schema drift and integration test failures.
Procedure
Regenerate the schema by running the following command:
$ make schema