POST /joke

Adds a joke to the system

Body object

One of:

Responses

  • 201

    item created

    Hide response attributes Show response attributes object
    • id string Required

      The id of the Joke. Assigned when added.

    • joke string Required

      The lead-in to the joke.

    • punchline string Required

      This bit should make you laugh :).

    • category string Required

      the category of the joke.

      Values are Word game, Classic, School, KnockKnock, or French humour.

    • thumbsUp integer Required

      Count of upvotes for the joke.

    • thumbsDown integer Required

      Count of down votes for the joke.

    • dateAdded string(date-time) Required
  • 400

    invalid input, object invalid

  • 409

    an existing item already exists

POST /joke
curl \
 -X POST https://joke_api.example.com/joke \
 -H "Content-Type: application/json" \
 -d '{"joke":"Knock Knock. Who's there? Hike. Hike Who?","punchline":"I didn't know you liked Japanese poetry.","category":"KnockKnock"}'
Request examples
{
  "joke": "Knock Knock. Who's there? Hike. Hike Who?",
  "punchline": "I didn't know you liked Japanese poetry.",
  "category": "KnockKnock"
}
{
  "joke": "He had a photographic memory but never developed it.",
  "category": "Word game"
}
Request examples
{
  "joke": "Knock Knock. Who's there? Hike. Hike Who?",
  "category": "KnockKnock",
  "punchline": "I didn't know you liked Japanese poetry."
}
{
  "joke": "He had a photographic memory but never developed it.",
  "category": "Word game"
}
Response examples (201)
[
  {
    "id": 33,
    "joke": "He used to take his dog to school every day, but he finally had to stop. How come?",
    "punchline": "The dog got graduated.",
    "category": "School",
    "dateAdded": "2017-07-12T20:12:33.001Z",
    "thumbsUp": 3,
    "thumbsDown": 3
  }
]
[
  {
    "id": 42,
    "joke": "What is the name to open the door?",
    "punchline": "Open your chakra",
    "category": "Classic",
    "dateAdded": "1998-07-12T20:12:33.001Z",
    "thumbsUp": 4,
    "thumbsDown": 2
  }
]
Response examples (201)
{
  "id": "string",
  "joke": "string",
  "punchline": "string",
  "category": "Word game",
  "thumbsUp": 42,
  "thumbsDown": 42,
  "dateAdded": "2025-05-04T09:42:00Z"
}