Skip to content

marcaum54/zappts-api

Repository files navigation

Zappts API

https://api-zappts.herokuapp.com/

Endpoints

GET /

 

To check if API is online

Response

Status: 200 (text/plain)

cURL

curl --location --request GET 'https://api-zappts.herokuapp.com/'

 

POST /authenticate

 

Route to identify yourself and access the token The system has 3 users: santa-claus, good-child, bad-child. All with password: 123123123

Params

  • username
  • password

Response

Status: 200 (application/json)

cURL

curl --location --request POST 'https://api-zappts.herokuapp.com/authenticate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=santa-claus' \
--data-urlencode 'password=123123123'

 

All of the following endpoints need an Authorization Token in the Header

POST /current-user

 

Route to check if the token is still valid and the data of the respective user

Response

Status: 200 (application/json)

cURL

curl --location --request POST 'https://api-zappts.herokuapp.com/current-user' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjMsImlhdCI6MTYwOTY2NDA3OX0.O80W7_IF5x4hau511Y1IbAEIKnDUO61JccZHYxr2FD0'

 

GET /letters

 

Params

  • page (optional / Default: 1)
  • order (optional / Default: 'DESC')

Response

Status: 200 (application/json)

cURL

curl --location --request GET 'https://api-zappts.herokuapp.com/letters' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEsImlhdCI6MTYwOTcwMDgyN30.d2Rg8C8iLfKSmO1IRFQIhsaY1KjuL8WjFEONWhLL6nE'

 

POST /letters

 

Route to insert a letter

Params

  • title (required)
  • body (required)

Response

Status: 200 (application/json)

cURL

curl --location --request POST 'https://api-zappts.herokuapp.com/letters' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEsImlhdCI6MTYwOTcwMDgyN30.d2Rg8C8iLfKSmO1IRFQIhsaY1KjuL8WjFEONWhLL6nE' \
--form 'title="Lorem ipsum"' \
--form 'body="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a diam sit amet purus tempus rhoncus efficitur in eros."'

 

PUT /letters/:uuid

 

Route to update a letter

Params

  • title (optional)
  • body (optional)

Response

Status: 200 (application/json)

cURL

curl --location --request PUT 'https://api-zappts.herokuapp.com/letters/c6d2666c-151c-4ea6-aa6d-8ff55f742148' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEsImlhdCI6MTYwOTcwMDgyN30.d2Rg8C8iLfKSmO1IRFQIhsaY1KjuL8WjFEONWhLL6nE' \
--form 'title="Updated - Lorem Ipsum"' \
--form 'body="Updated - Dolor sit amet, consectetur adipiscing elit."'

 

DELETE /letters/:uuid

 

Route to delete a letter

Response

Status: 204 - No Content

cURL

curl --location --request DELETE 'https://api-zappts.herokuapp.com/letters/c6d2666c-151c-4ea6-aa6d-8ff55f742148' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIsImlhdCI6MTYwOTYxMjk5OH0.eD4yBcoKoEAGCslTKFqEB5EaXLJh-URbomSBl5fS118'

 

GET /letters/:uuid

 

Route to show a letter

Response

Status: 200 - (application/json)

cURL

curl --location --request GET 'https://api-zappts.herokuapp.com/letters/c6d2666c-151c-4ea6-aa6d-8ff55f742148' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEsImlhdCI6MTYwOTcwMDgyN30.d2Rg8C8iLfKSmO1IRFQIhsaY1KjuL8WjFEONWhLL6nE'

 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published