Slugs API - GET / PUT / DELETE - /api/keys/slug/:slug

Use this endpoint to:
  • retrieve informatio about a single key via it's slug value
  • increment the value of the key
  • delete that key via it's slig value

GET /api/keys/slug/:slug

This endpoint will:
  • return the slug found in the database
Request:
GET https://nifty-dogs-api.herokuapp.com/api/keys/slug/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"
}

PUT /api/keys/slug/:slug

This endpoint will:
  • increment the value of the key/slug found in the database
Request:
PUT https://nifty-dogs-api.herokuapp.com/api/keys/slug/test-test-test-again/
Response:

{
    "id": 4,
    "key": "test test test again",
    "int_value": 2,
    "slug": "test-test-test-again",
    "created_at": "2022-12-13T07:38:07.492563Z",
    "updated_at": "2022-12-13T07:45:05.594910Z"
}

DELETE /api/keys/slug/:slug

This endpoint will:
  • delete the key/slug found in the database
Request:
DELETE https://nifty-dogs-api.herokuapp.com/api/keys/slug/test-test-test-again/
Response:
{ 'message': 'The key was deleted successfully!' }