example-data.com
Menu
Browse docs and collections

Overview

goals / #221

Sleep 8 hours nightly

userId
Joseph Steuber @joseph_steuber
name
Sleep 8 hours nightly
category
sleep
targetValue
9
currentValue
6
unit
hours/night
deadline
isCompleted
false
createdAt

Component variants

Related

Request

curl example

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

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/goals/221"
);
const goal = await res.json();

TypeScript example

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

const res = await fetch(
  "https://example-data.com/api/v1/goals/221"
);
const goal = (await res.json()) as Goal;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/goals/221"
)
goal = res.json()

Response

{
  "id": 221,
  "userId": 221,
  "name": "Sleep 8 hours nightly",
  "category": "sleep",
  "targetValue": 9,
  "currentValue": 6,
  "unit": "hours/night",
  "deadline": null,
  "isCompleted": false,
  "createdAt": "2025-07-12T15:23:27.009Z"
}