- Author: Jack Jiang
- Date: Jul. 2019
CRUD | HTTP Method | URL |
---|---|---|
Create | POST | @server/keys/ |
Read | GET | @server/keys/@key |
Update | PUT | @server/keys/@key |
Delete | DELETE | @server/keys/@key |
Debug | GET | @server/debug/ |
- URL: @server/keys/
- HTTP Method: POST
- Body:
{
"key": @key,
"firstName": "Jack",
"LastName": "Jiang"
}
succeed
- HTTP Status Code: 201
- Body:
{
"key": @key,
"firstName": "Jack",
"LastName": "Jiang"
}
conflict
- HTTP Status Code: 409
- Body:
{
"key": @key,
"errorMsg": "conflict"
}
bad request
- HTTP Status Code: 400
- Body:
{
"errorMsg": "bad request"
}
- URL: @server/keys/@key
- HTTP Method: GET
- Body: Null
succeed
- HTTP Status Code: 200
- Body:
{
"key": @key,
"firstName": "Jack",
"LastName": "Jiang"
}
not found
- HTTP Status Code: 404
- Body:
{
"key": @key,
"errorMsg": "not found"
}
- URL: @server/keys/@key
- HTTP Method: PUT
- Body:
{
"firstName": "Jack",
"LastName": "Jiang"
}
succeed
- HTTP Status Code: 200
- Body:
{
"key": @key,
"firstName": "Jack",
"LastName": "Jiang"
}
not found
- HTTP Status Code: 404
- Body:
{
"key": @key,
"errorMsg": "key not found"
}
bad request
- HTTP Status Code: 400
- Body:
{
"errorMsg": "bad request"
}
- URL: @server/keys/@key
- HTTP Method: DELETE
- Body: Null
Succeed
- HTTP Status Code: 200
- Body:
{
"key": @key,
"firstName": "Jack",
"LastName": "Jiang"
}
Fail
- HTTP Status Code: 404
- Body:
{
"key": @key,
"errorMsg": "key not found"
}
database will be printed out on back-end terminal
- URL: @server/debug/
- HTTP Method: GET
- Body: Null