NGINX Modern Apps > Class 10 - NMS API Connectivity Manager > Module 3 - API Team - Publish API v1.0 Source | Edit on
Step 4 - Publish API v1.0¶
Before publishing our first API, we must understand what the DevOps (or API Dev) team provided us.
They provided us with an OpenAPI spec file (OASv3) via SwaggerHub. You can consult version 1.0 here: https://app.swaggerhub.com/apis/F5EMEASSA/API-Sentence-2022/v1
Note
This is version 1.0 of the API, and in this version, as you can notice, the Colors micro-service is not yet available. This means that with this spec file, we will publish the API Sentence application without the Colors micro-service (e.g., a sample sentence might look like calm mouse of the mountain).
Create the API Services¶
- In NMS ACM UI, click on the
Servicesmenu on the left - Create a new workspace. As you can notice,
Infra teamandAPI teamhave their separate workspaces- Name : sentence-app
- Click on
Back to Workspacesand click onsentence-appworkspace just created
Note
We will expose the API and document it on Dev-Portal at the same time.
Upload the OpenAPI Spec file¶
Click on the
API Docstab
Click on
Add API Docand drag-drop the Swagger file, then clickSaveNote
In Win10 RDP Jumphost, the Swagger file located on the desktop (oas-sentence-v1.yaml)
Expose the API proxy¶
Click on
API Proxiestab, and clickPublish to ProxyBackend Service
- Name : sentence-svc
- Service Target Hostname : 10.1.20.7 (this is the K3S Ingress IP Address)
- Service Target Transport Protocol : HTTP
- Service Target Port : 30511 (K8S Node Port)
Note
autocomplete may cause problems; if you copy and past over the port, it may be easier
API Proxy
- Name : sentence-api
- Use an OpenAPI Spec ? -> YES
- API Spec : api-sentence-generator-v1
- Gateway Proxy Hostname : api.sentence.com
Developer Portal
- Check the box “Also publish API to developer portal” - This will push documentation in Developer Portal
- Portal Proxy Hostname : dev.sentence.com
- No Category
Click
PublishClick
Back to workspace
Customize and finalize the configuration¶
The configuration still needs to be finished.
- Define how the API Gateway will
routethe API requests perVersion
Edit the API Proxy just created (sentence-api) by clicking on the three dots on the top right of the row, then click
Edit Proxy.
As you can notice, the first page (configuration) is what we just created previously. Click on
NextConfigure the
Ingressas belowAppend Rule : Prefix - version/basepath
Strip Base Path and Version before proxying the request : YES
Select Status : Latest
Click
Next
Click
Next>NextthenSave and Publish
Note
Congrats, your first API is exposed on the Nginx API Gateway and Documented in the Developer Portal.