POST /joke

Adds a joke to the system

application/json

Body object

One of:

Responses

  • 201 application/vnd.json

    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 \
 --request POST 'https://joke_api.example.com/joke' \
 --header "Content-Type: application/json" \
 --data '{"joke":"Knock Knock. Who's there? Hike. Hike Who?","category":"KnockKnock","punchline":"I didn't know you liked Japanese poetry."}'
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?",
    "category": "School",
    "thumbsUp": 3,
    "dateAdded": "2017-07-12T20:12:33.001Z",
    "punchline": "The dog got graduated.",
    "thumbsDown": 3
  }
]
[
  {
    "id": 42,
    "joke": "What is the name to open the door?",
    "category": "Classic",
    "thumbsUp": 4,
    "dateAdded": "1998-07-12T20:12:33.001Z",
    "punchline": "Open your chakra",
    "thumbsDown": 2
  }
]