Key Detail API - GET, PUT, DELETE - /api/keys/id/
Use this endpoint to:
- retrieve information about a single key from the database
- update information about a single key
- delete an individual key
GET /api/keys/id/
This endpoint will:
- return the key with that id
Request:
GET https://nifty-dogs-api.herokuapp.com/api/keys/4/
Response:
{
"id": 4,
"key": "test test test",
"int_value": 1,
"slug": "test-test-test",
"created_at": "2022-12-11T02:05:53.290299Z",
"updated_at": "2022-12-11T02:05:53.290380Z"
}
PUT /api/keys/id/
This endpoint will:
- update the database entry and return the updated model instance
Request:
GET https://nifty-dogs-api.herokuapp.com/api/keys/4/
Body:
{ "key": "test test test again" }
Response:
{
"id": 4,
"key": "test test test again",
"int_value": 1,
"slug": "test-test-test-again",
"created_at": "2022-12-13T07:38:07.492563Z",
"updated_at": "2022-12-13T07:45:05.594910Z"
}
DELETE /api/keys/id/
This endpoint will:
- delete the database entry for that id
Request:
DELETE https://nifty-dogs-api.herokuapp.com/api/keys/4/
Response:
{ 'message': 'The key was deleted successfully!' }