Simple demo, for reference only
Recommended reading: RESETful API design specification with a sense of practice for front and back end separation
GET the query
method: GET
api: /v1/xxx/
params:
The parameter name | type | mandatory | instructions | content-type |
---|---|---|---|---|
id | string | is | multiple/form-data |
response:
code | msg | data | content-type |
---|---|---|---|
error | Incorrect input! | json | |
success | Success! | Retrieved data (see example) | json |
Example:
{
"code": "success"."msg": "Succeed!"."data": [{"id": 1."data": "",},... ] }Copy the code
POST new
method: POST
api: /v1/xxx/
body:
The parameter name | type | mandatory | instructions | content-type |
---|---|---|---|---|
id | string | is | multiple/form-data | |
info | string | is | multiple/form-data |
response:
code | msg | content-type |
---|---|---|
error | Incorrect input! | json |
success | Added successfully! | json |
Example:
{
"code": "success"."msg": "Added successfully!"
}
Copy the code
Delete Delete
method: delete
api: /v1/xxx/
body:
The parameter name | type | mandatory | instructions | content-type |
---|---|---|---|---|
id | string | is | multiple/form-data | |
info | string | is | multiple/form-data |
response:
code | msg | content-type |
---|---|---|
error | Incorrect input! | json |
success | Deleted successfully! | json |
Example:
{
"code": "success"."msg": "Delete successful!"
}
Copy the code