February 2020
Intermediate to advanced
404 pages
8h 42m
English
Before creating any API, we should know what the specifications of APIs are in the form of a document. We showed an example in Chapter 2, Handling Routing for our REST Services, where we showed the URL shortener API design document. Let's try to create one for this Metro Rail project. Take a look at the following table:
| HTTP verb | Path | Action |
Resource |
| POST |
/v1/train (details as JSON body) |
Create |
Train |
| POST |
/v1/station (details as JSON body) |
Create |
Station |
| GET | /v1/train/id |
Read |
Train |
| GET | /v1/station/id |
Read |
Station |
| POST |
/v1/schedule (source and destination) |
Create |
Route |
We can also include the UPDATE and DELETE methods. By implementing the preceding design, it will be obvious ...
Read now
Unlock full access