example-data.com
Menu
Browse docs and collections

Overview

nutrition-logs / #42

Component variants

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/nutrition-logs/42" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/nutrition-logs/42"
);
const nutritionLog = await res.json();

TypeScript example

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

const res = await fetch(
  "https://example-data.com/api/v1/nutrition-logs/42"
);
const nutritionLog = (await res.json()) as NutritionLog;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/nutrition-logs/42"
)
nutrition_log = res.json()

Response

{
  "id": 42,
  "userId": 22,
  "date": "2025-10-04",
  "totalCalories": 2375,
  "totalProteinGrams": 108.4,
  "totalCarbsGrams": 392.1,
  "totalFatGrams": 41.4,
  "waterMl": 2574,
  "createdAt": "2025-10-04T23:59:59.999Z"
}