Supposing I have requirements:
How should be endpoints REST API structure?
Always ask yourself:
What are my Resources?
POST /api/registration
POST /api/providerRegistration
GET /api/user?userId={userId}
GET /api/friends
GET /api/friends?userId={userId}
POST /api/product
PUT/PATCH /api/product/{productId}
GET /api/products?status={status}
GET /api/products?userId={userId}
And so on - you get the gist of it. Note that the path (REST Resource) is a noun ( product
), not a verb ( search
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.