Welcome to this example API for the (not yet official) RaspAPI YSWS
program. This website is pretty simple, and it gives a pretty good idea on
what submissions should look like. The website is pretty buggy at the
moment, but clicking on the logo will take you back to this page.
curl -X POST https://raspapi-example.adamthegreat.hackclub.app/
Returns:
{'q': 'Why do programmers hate camping?', 'a': 'Because there are a lot of bugs.', 'tags': ['programming', 'pun']}
POST /puns
Parameters: number (optional)
Returns a list of random jokes in JSON format. If number is not given,
returns all jokes.
Example usage:
curl -X POST https://raspapi-example.adamthegreat.hackclub.app/puns -H "Content-Type: application/json" -d '{"number": 3}'
Returns:
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]
POST /joke-of-the-day
Parameters: date (optional)
Returns a random joke in JSON format. If date is given, it fetches the
joke of the day for that date. If date is not given, it fetches the joke
of the day for today.
Example usage:
curl -X POST http://127.0.0.1:8080/joke-of-the-day -H "Content-Type: application/json" -d '{"date": ""}'
Returns:
{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}
GET /generate-joke
Parameters: prompt (optional)
Returns a random joke in plain text. If prompt is given, it generates a
joke relating to the prompt. If prompt is not given, it generates a
random programming related joke.
Q: Why do programmers hate camping? A: Because there are a lot of bugs.
POST /generate-joke
Parameters: prompt (optional)
Returns a random joke in JSON format. If prompt is given, it generates a
joke relating to the prompt. If prompt is not given, it generates a
random programming related joke.
{"q": "Since generating jokes costs money, you will need to copy and paste the above into your terminal to see an actual result.", "a": "Sorry for any inconvenience.", "tags": ["money", "cost", "copy","paste"]}
GET /search-jokes
Parameters: query
Returns this HTML page containing a list of jokes that contain the
query.
Returns a list of jokes in JSON format that contain the query. If limit
is given, it returns at most limit jokes. If limit is not given, it
returns at most 10 jokes.
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]
POST /get-jokes-by-tag
Parameters: tag
Returns a list of jokes in JSON format that contain the tag.
Example usage:
curl -X POST https://raspapi-example.adamthegreat.hackclub.app/get-jokes-by-tag -H "Content-Type: application/json" -d '{"tag": "programming"}'
Returns:
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]