当前位置:网站首页>[development team follows] API specification
[development team follows] API specification
2022-07-04 02:44:00 【ReactSpring】
URL Use horizontal bars to separate words
/system-ordersThe parameters are named after the small hump
/system-orders/{orderId}Get the plural words used in the collection
GET /usersURL Don't use verbs in it
PUT /user/{userId}JSON The attribute is named after the small hump
{ userName: "Mohammad Faisal" userId: "1" }The response body should contain the number of resources
{ users: [ ... ], total: 34 }stay GET Always accept... In operation limit and offset Parameters
GET /shops?offset=5&limit=5
- Add one fields Parameters , Public only API Required fields in
Return only the name of the store , Address and contact information .
GET /shops?fields=id,name,address,contact
adopt HTTP Ask the head to carry Token
Authorization: Bearer xxxxxx, Extra yyyyyAlways verify content type
```api
content-type: application/json
```
Yes CRUD Function USES HTTP Method
GET: Retrieve the representation of the resource . POST: Create new resources and sub resources . PUT: Update existing resources . PATCH: Update existing resources , It only updates the fields provided , Without updating other fields . DELETE: Delete existing resources .In nested data URL Use in HTTP Method
GET /shops/2/products: from shop 2 Get a list of all products . GET /shops/2/products/31: Get product 31 Details of , product 31 Belong to shop 2. DELETE /shops/2/products/31: Products should be deleted 31, It belongs to the store 2. PUT /shops/2/products/31: Products should be updated 31 Information about , Only in resource-URL Upper use PUT, It's not a collection . POST /shops: A new store should be created , And return the details of the new store created . In collection url Upper use POST.CORS Cross-domain resource sharing
It must be for all public oriented API Support CORS( Cross source resource sharing ) Head . Consider support CORS Allow the “*” source , And through effective OAuth Token forced authorization . Avoid combining user credentials with original authentication .Security
At all endpoints 、 Implement on resources and services HTTPS(tls encryption ). Force and require all callbacks url、 Push notification endpoint and webhooks Use HTTPS.General principles
Flat is better than nested . Simplicity is better than complexity . Strings are better than numbers . Consistency is better than customization .
边栏推荐
- Global and Chinese market of cell scrapers 2022-2028: Research Report on technology, participants, trends, market size and share
- Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
- The first spring of the new year | a full set of property management application templates are presented, and Bi construction is "out of the box"
- Design and implementation of redis 7.0 multi part AOF
- Advanced learning of MySQL -- Application -- storage engine
- A. ABC
- MySQL advanced (Advanced) SQL statement (I)
- [untitled] the relationship between the metauniverse and digital collections
- The difference between int (1) and int (10)
- Résumé: entropie, énergie libre, symétrie et dynamique dans le cerveau
猜你喜欢

FRP intranet penetration

What are the conditions for the opening of Tiktok live broadcast preview?

16. System and process information

Network byte order

Example 073 square sum value judgment programming requires the input of a and B, if a ²+ b ² If the result of is greater than 100, a is output ²+ b ² Value, otherwise output the result of a + B.

Redis transaction

Gee import SHP data - crop image

150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan

Example 072 calculation of salary it is known that the base salary of an employee of a company is 500 yuan. The amount of software sold by the employee and the Commission method are as follows: Sales

AI 助力藝術設計抄襲檢索新突破!劉芳教授團隊論文被多媒體頂級會議ACM MM錄用
随机推荐
Summarize the past to motivate yourself to move on
中電資訊-信貸業務數字化轉型如何從星空到指尖?
MySQL advanced SQL statement (1)
Network byte order
Safety tips - seat belt suddenly fails to pull? High speed police remind you how to use safety belts in a standardized way
[Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
Unity writes a character controller. The mouse controls the screen to shake and the mouse controls the shooting
求esp32C3板子連接mssql方法
Lichuang EDA learning notes 14: PCB board canvas settings
機器學習基礎:用 Lasso 做特征選擇
High level application of SQL statements in MySQL database (I)
ZABBIX API batch delete a template of the host
Save Private Ryan - map building + voltage dp+deque+ shortest circuit
The boss said: whoever wants to use double to define the amount of goods, just pack up and go
Remote work guide
Osnabrueck University | overview of specific architectures in the field of reinforcement learning
Key knowledge of embedded driver
Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
From the 18th line to the first line, the new story of the network security industry
A. Div. 7