api-charadas
api-charadas copied to clipboard
An API that give random jokes in Portuguese.
Puzzles or jokes API to make the world a little happier :)
How To Use | Technologies | References | Authors
:information_desk_person: How To Use
:unlock: Public routes
:globe_with_meridians: REQUEST
GET /puzzle?lang=ptbr
Parameter | Type variable | Type param | Description | Is required? |
---|---|---|---|---|
lang |
string |
query |
There are jokes in many languages | Yes |
:zap: RESPONSE
STATUS CODE: 200
{
"_id": "60292b0e73850b391c8c4918",
"question": "Qual o doce preferido dos noivos?",
"answer": "Bem-casado.",
"lang": "ptbr",
"__v": 0
}
STATUS CODE: 400
{
"error": "Language required"
}
STATUS CODE: 404
{
"error": "Puzzle with this language was not found"
}
:lock: Private routes
:key: All private routes require a security parameter. It is only possible to access the routes, passing this parameter. How does this parameter work?
Parameter | Type variable | Type param | Description | Is required? |
---|---|---|---|---|
token |
string |
header |
A security token in a hash type | Yes |
:globe_with_meridians: REQUEST
:exclamation: This route has no parameters
POST /puzzle
:zap: RESPONSE
STATUS CODE: 200
[
{
"_id": "60292b0e73850b391c8c47e1",
"question": "O que o Google pai disse para o Google filho na hora do jantar?",
"answer": "Google, Chrome.",
"lang": "ptbr"
},
{
"_id": "60292b0e73850b391c8c47e2",
"question": "Eu ia convidar 20 pessoas para a churrascada, uma morreu, o que faço?",
"answer": "Covid 19.",
"lang": "ptbr"
},
...
]
STATUS CODE: 401
{
"error": "Token not provided"
}
STATUS CODE: 401
{
"error": "Token invalid"
}
:globe_with_meridians: REQUEST
DELETE /puzzle/id
Parameter | Type variable | Type param | Description | Is required? |
---|---|---|---|---|
id |
string |
default |
if you don't pass the ID all the jokes will be removed | No |
:zap: RESPONSE
STATUS CODE: 200
{
"message": "Successfully removed"
}
STATUS CODE: 400
{
"error": "Invalid ID"
}
STATUS CODE: 404
{
"error": "Puzzle was not found"
}
:rocket: Technologies
- NodeJS
- MongoDB
- Mongoose
- ExpressJS