example-data.com
Menu
Browse docs and collections

Overview

book-favs / #254

Activity #254

User #147 favorited Book #132

8/3/2024, 5:29:45 AM

Component variants

Medium
Small

User #147 favorited Book #132 · 8/3/2024, 5:29:45 AM

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/book-favs/254" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/book-favs/254"
);
const bookFav = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/book-favs.d.ts https://example-data.com/types/book-favs.d.ts
import type { BookFav } from "./types/book-favs";

const res = await fetch(
  "https://example-data.com/api/v1/book-favs/254"
);
const bookFav = (await res.json()) as BookFav;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/book-favs/254"
)
book_fav = res.json()

Response

{
  "id": 254,
  "userId": 147,
  "bookId": 132,
  "savedAt": "2024-08-03T05:29:45.610Z"
}