NGINX Modern Apps > Class 10 - NMS API Connectivity Manager > Module 3 - API Team - Publish API v1.0 Source | Edit on
Step 5 - Test API v1.0¶
To test the API, we will use Postman. In the real world, an API is consumed by a mobile or modern application (or a machine).
Steps¶
RDP to Jumphost as login
userand passworduserOpen
PostmanOpen the collection
Sentence APIand run the callGET Adjectivesby clickingSend- Look at the request : http://api.sentence.com/v1/api/adjectives
- Endpoint FQDN is the Nginx API Proxy (api.sentence.com) configured by the
Infra team - The version is
v1coming from the OpenAPI File - The base path is
apicoming from the OpenAPI File - As a reminder, from the previous configuration, we chose to
stripthe version and the basepath before forwarding the request to the backend. It means the backend server will receive/adjectivesand not/v1/api/adjectives
You should receive all the
wordsfrom theadjectivespod.[ { "id": 1, "name": "kind" }, { "id": 2, "name": "proud" }, { "id": 3, "name": "calm" } ]
Now, send the request for
GET Colors. As a reminder, this API Endpoint is not yet published by API Team and is not part of the OpenAPI File.- You should receive a
404from the API Gateway
{ "message": "Not Found", "status": "404" }
- You should receive a
What did happen, and what did we do?¶
- The backend server is a modern app listening on http://10.1.20.7:30511
- The API Server exposes several APIs on 3 PATHS (version 1)
- /adjectives
- /animals
- /locations
- The API gateway will expose the different versions of this API; that’s why the API Gateway takes care of the
versionand thebase path. - The API gateway
stripstheversionand thebase pathas the back-end server does not need/care for them. They are used torouterequests to the right API. - And as
/colorsis not part of the OpenAPI spec file, the API Gateway rejects this request.