/api-o11y

Repository used in a talk about APIs and Observability

Primary LanguageGo

API Observability

Building

docker compose up -d --build

Using the services

Auth

curl -X "POST" "http://localhost:8081/v1/auth" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d $'{
  "email": "eminetto@email.com",
  "password": "12345"
}'

The result should be a token, like:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImVtaW5ldHRvQGVtYWlsLmNvbSIsImV4cCI6MTY4MTM0ODQ3MSwiaWF0IjoxNjgxMzQ0ODQxLCJuYmYiOjE2ODEzNDQ4NDF9.GdUiLYqrXeUZNIgHDhGDhGIV1NpN941UiFBqgvSoS-4"
}

Feedback

You need to use the token generated by the Auth service:

curl -X "POST" "http://localhost:8082/v1/feedback" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
	 -H 'Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImVtaW5ldHRvQGVtYWlsLmNvbSIsImV4cCI6MTY4MTM0ODQ3MSwiaWF0IjoxNjgxMzQ0ODQxLCJuYmYiOjE2ODEzNDQ4NDF9.GdUiLYqrXeUZNIgHDhGDhGIV1NpN941UiFBqgvSoS-4' \
     -d $'{
  "title": "Feedback test",
  "body": "Feedback body"
}'

Vote

You need to use the token generated by the Auth service:

curl -X "POST" "http://localhost:8083/v1/vote" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
	 -H 'Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImVtaW5ldHRvQGVtYWlsLmNvbSIsImV4cCI6MTY4MTM0ODQ3MSwiaWF0IjoxNjgxMzQ0ODQxLCJuYmYiOjE2ODEzNDQ4NDF9.GdUiLYqrXeUZNIgHDhGDhGIV1NpN941UiFBqgvSoS-4' \
     -d $'{
  "talk_name": "Go e Microserviços",
  "score": "10"
}'