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
user
and passworduser
Open
Postman
Open the collection
Sentence API
and run the callGET Adjectives
by 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
v1
coming from the OpenAPI File - The base path is
api
coming from the OpenAPI File - As a reminder, from the previous configuration, we chose to
strip
the version and the basepath before forwarding the request to the backend. It means the backend server will receive/adjectives
and not/v1/api/adjectives
You should receive all the
words
from theadjectives
pod.[ { "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
404
from 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
version
and thebase path
. - The API gateway
strips
theversion
and thebase path
as the back-end server does not need/care for them. They are used toroute
requests to the right API. - And as
/colors
is not part of the OpenAPI spec file, the API Gateway rejects this request.