authentication key
The authentication of the API calls is made with a Bearer token. To authenticate your requests a header entry
specifying the authentication of the request should be added. To quickly allow you to identify your records each token has an id which is
the first number before the pipe, so if your key starts with 12 the records that his token_id
is equal
to 12 are your records.
All tokens allow the users to retrieve (GET) and create (POST) db records as you please, but you only can modify (PUT) or
delete (DELETE) records created with the same authentication token that is used to make the call. The column token_id
of the db tables shows the id of the token used
to create the record.
The endpoint of the API is https://public-api.rmedico.com/api
. Remember that requests to the API also has to
include the Accept: application/json
header and the authentication header that, in this case, looks like this:
Authorization: Bearer {{token provided}}
. Tokens will be valid for 24 hours.
api documentation
The documentation of the API is where you can see all endpoints and how to interact with everyone of them. The documentation was made with Swagger using the composer package darkaonline/l5-swagger. This kind of documentation allows you to authenticate yourself with the provided token and to make real API calls. Then the changes that you make to the db can be seen in the below db content section.
db content
table: people
Holds people information.
id | name | birthday | token_id | created_at | updated_at |
---|---|---|---|---|---|
1 | roger | 17/11/1989 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
2 | magda | 27/10/1994 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
3 | John Wick | 30/05/1980 | 1 | 24/04/2023 18:15:26 | 24/04/2023 18:15:26 |
table: pets
Holds pets information.
id | name | pet_type_id | token_id | created_at | updated_at |
---|---|---|---|---|---|
1 | yuno | 1 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
2 | arya | 1 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
4 | Charlie | 1 | 28 | 04/05/2023 09:03:21 | 04/05/2023 09:03:21 |
table: pet_types
Holds pet types information.
id | name | token_id | created_at | updated_at |
---|---|---|---|---|
1 | cat | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
2 | dog | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
3 | tortoise | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
4 | parrot | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
table: person_pet
Holds the relations between people and pets.
id | person_id | pet_id | adopted | token_id | created_at | updated_at |
---|---|---|---|---|---|---|
1 | 1 | 1 | 05/03/2013 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |
2 | 2 | 2 | 13/05/2015 | 0 | 24/04/2023 18:13:21 | 24/04/2023 18:13:21 |