Riddles-API
Riddles-API copied to clipboard
API offers a diverse collection of riddles across various categories, including science, who-am-i, math, mystery, funny and logic.Integrate our API into your application to provide users with endless...
Riddles API
Welcome to the Riddles API! This API provides a collection of riddles across various categories including funny, math, logic, and mystery. It's a fun way to challenge your mind and entertain yourself or your users with interesting riddles.
Base API URL
https://riddles-api-eight.vercel.app/{ category }
Routes
-
Funny Riddles:
/funny- Endpoint to get funny riddles that will tickle your funny bone.
-
Math Riddles:
/math- Endpoint to get math-related riddles that will test your mathematical skills.
-
Logic Riddles:
/logic- Endpoint to get logic-based riddles that will make you think outside the box.
-
Mystery Riddles:
/mystery- Endpoint to get mysterious riddles that will keep you guessing.
-
Science Riddles:
/science- Endpoint to get science riddles that incorporate scientific concepts or phenomena..
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /category | Retrieve specific riddle |
| GET | /category/number | Get specified no. of riddles. |
| POST | /category | Add a new riddle. |
| PATCH | /category/id | Update an existing riddle. |
| DELETE | /category/id | Deletes an existing riddle. |
Example
Retrive riddles of science catefory
Get riddle based on science
https://riddles-api-eight.vercel.app/science
Response
{
"riddle": "string",
"answer": "string",
"category": "string"
}
Get 100 riddles based on science
https://riddles-api-eight.vercel.app/science/100
Response
{
"riddlesArray": ["riddleQuestions"],
"answer": "string",
"category": "string"
}
Post Riddle
POST/{ category }
https://riddles-api-eight.vercel.app/{category}
Response
{
"message": "Riddle posted successfully",
"riddleQuestion": "riddleQuestion._id"
}
Installation
-
Clone the repository:
git clone https://github.com/Thiru-kumaran-R/Riddles-API.git -
Go to project folder:
cd project -
Start the server:
npm start
Error Handling
In case of any error, the API will return a JSON response with an appropriate status code and error message
Example
{
"message": "No such route exits",
"status": 404
}