example-data.com
Menu
Browse docs and collections

Overview

carts / #2

Component variants

Medium

#2

#2

Small
carts/2

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/carts/2" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/carts/2"
);
const cart = await res.json();

TypeScript example

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

const res = await fetch(
  "https://example-data.com/api/v1/carts/2"
);
const cart = (await res.json()) as Cart;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/carts/2"
)
cart = res.json()

Response

{
  "id": 2,
  "userId": 3,
  "currency": "USD",
  "subtotal": 1905.37,
  "itemCount": 8,
  "updatedAt": "2025-11-03T11:43:02.981Z",
  "createdAt": "2024-11-29T19:41:51.515Z"
}