当前位置:网站首页>[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 contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share
- Talking about custom conditions and handling errors in MySQL Foundation
- Summarize the past to motivate yourself to move on
- Pagoda SSL can't be accessed? 443 port occupied? resolvent
- 12. Gettimeofday() and time()
- Key knowledge of embedded driver
- Global and Chinese market of thin film deposition systems 2022-2028: Research Report on technology, participants, trends, market size and share
- C # learning notes: structure of CS documents
- ZABBIX API pulls the values of all hosts of a monitoring item and saves them in Excel
- [untitled]
猜你喜欢

Network communication basic kit -- IPv4 socket structure

MySQL workbench use

Buuctf QR code

String & memory function (detailed explanation)

Problems and solutions of several concurrent scenarios of redis

I stepped on a foundation pit today

Save Private Ryan - map building + voltage dp+deque+ shortest circuit

7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages

The automatic control system of pump station has powerful functions and diverse application scenarios

Yyds dry goods inventory override and virtual of classes in C
随机推荐
Keep an IT training diary 054- opening and closing
Yyds dry goods inventory it's not easy to say I love you | use the minimum web API to upload files
Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami
Global and Chinese market for travel wheelchairs 2022-2028: Research Report on technology, participants, trends, market size and share
Pytoch residual network RESNET
求esp32C3板子連接mssql方法
Chain ide -- the infrastructure of the metauniverse
Global and Chinese market of digital impression system 2022-2028: Research Report on technology, participants, trends, market size and share
Network communication basic kit -- IPv4 socket structure
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
96% of the collected traffic is prevented by bubble mart of cloud hosting
[Yugong series] February 2022 attack and defense world advanced question misc-84 (MySQL)
Question d: Haffman coding
AI 助力藝術設計抄襲檢索新突破!劉芳教授團隊論文被多媒體頂級會議ACM MM錄用
[Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
The requests module uses
Network byte order
The difference between lambda expressions and anonymous inner classes
LV1 Roche limit
Data collection and summary