当前位置:网站首页>[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-orders
The parameters are named after the small hump
/system-orders/{orderId}
Get the plural words used in the collection
GET /users
URL 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 yyyyy
Always 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 .
边栏推荐
- Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
- PMP daily three questions (February 14, 2022)
- Libcblas appears when installing opencv import CV2 so. 3:cannot open shared object file:NO such file or directory
- Amélioration de l'efficacité de la requête 10 fois! 3 solutions d'optimisation pour résoudre le problème de pagination profonde MySQL
- Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
- Safety tips - seat belt suddenly fails to pull? High speed police remind you how to use safety belts in a standardized way
- Optimization theory: definition of convex function + generalized convex function
- What are the main investment products of bond funds and what are they
- Practical multifunctional toolbox wechat applet source code / support traffic master
- ZABBIX API batch delete a template of the host
猜你喜欢
Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
Override and virtual of classes in C #
false sharing
[software implementation series] software implementation interview questions with SQL joint query diagram
Advanced learning of MySQL -- Application -- index
Learn these super practical Google browser skills, girls casually flirt
LV1 tire pressure monitoring
The automatic control system of pump station has powerful functions and diverse application scenarios
Kiss number + close contact problem
Node write API
随机推荐
Record a problem that soft deletion fails due to warehouse level error
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
Properties of binary trees (numerical aspects)
Mysql to PostgreSQL real-time data synchronization practice sharing
Ai aide à la recherche de plagiat dans le design artistique! L'équipe du professeur Liu Fang a été embauchée par ACM mm, une conférence multimédia de haut niveau.
A. Min Max Swap
96% of the collected traffic is prevented by bubble mart of cloud hosting
Life cycle of instance variables, static variables and local variables
Global and Chinese market of handheld melanoma scanners 2022-2028: Research Report on technology, participants, trends, market size and share
Unity knapsack system (code to center and exchange items)
Basic editing specifications and variables of shell script
ZABBIX API pulls the values of all hosts of a monitoring item and saves them in Excel
[untitled] the relationship between the metauniverse and digital collections
Talking about custom conditions and handling errors in MySQL Foundation
[software implementation series] software implementation interview questions with SQL joint query diagram
LV1 previous life archives
Chain ide -- the infrastructure of the metauniverse
Global and Chinese markets of advanced X-ray inspection system (Axi) in PCB 2022-2028: Research Report on technology, participants, trends, market size and share
Yyds dry goods inventory override and virtual of classes in C
Comment la transformation numérique du crédit d'information de la Chine passe - t - elle du ciel au bout des doigts?