jokes #28
- setup
- Why was the math book sad?
- punchline
- It had too many problems.
- category
- dad
- rating
- 4.5
- createdAt
Overview
Request
curl example
curl -sS \ "https://example-data.com/api/v1/jokes/28" \ -H "Accept: application/json"
JavaScript example
const res = await fetch( "https://example-data.com/api/v1/jokes/28" ); const joke = await res.json();
TypeScript example
// Download once: mkdir -p types && curl -o types/jokes.d.ts https://example-data.com/types/jokes.d.ts
import type { Joke } from "./types/jokes";
const res = await fetch(
"https://example-data.com/api/v1/jokes/28"
);
const joke = (await res.json()) as Joke; Python example
import requests
res = requests.get(
"https://example-data.com/api/v1/jokes/28"
)
joke = res.json() Response
{
"id": 28,
"setup": "Why was the math book sad?",
"punchline": "It had too many problems.",
"category": "dad",
"rating": 4.5,
"createdAt": "2024-11-04T17:27:40.126Z"
}