[英]Rest endpoints structure
假設我有要求:
端點REST API應該如何結構?
總是問自己:
我的資源是什么?
POST /api/registration
POST /api/providerRegistration
注冊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}
依此類推-您可以掌握要點。 請注意,路徑(REST資源)是名詞( product
),而不是動詞( search
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.