curl --fail-with-body --get \
"https://api-us.hihobbes.com/api/v1/sessions" \
--data-urlencode "date_from=2026-07-01T00:00:00Z" \
--data-urlencode "date_to=2026-07-11T00:00:00Z" \
--data-urlencode "limit=200" \
--data-urlencode "offset=0" \
--header "Authorization: Bearer $HOBBES_API_KEY"
import json
import os
import requests
endpoint = "https://api-us.hihobbes.com/api/v1/sessions"
headers = {"Authorization": f"Bearer {os.environ['HOBBES_API_KEY']}"}
offset = 0
with open("hobbes-sessions.ndjson", "w", encoding="utf-8") as output:
while True:
response = requests.get(
endpoint,
headers=headers,
params={
"date_from": "2026-07-01T00:00:00Z",
"date_to": "2026-07-11T00:00:00Z",
"limit": 200,
"offset": offset,
},
timeout=30,
)
response.raise_for_status()
payload = response.json()
for session in payload["sessions"]:
output.write(json.dumps(session) + "\n")
offset += payload["pagination"]["limit"]
if offset >= payload["pagination"]["total"]:
break
import { appendFile } from "node:fs/promises";
let offset = 0;
while (true) {
const url = new URL("https://api-us.hihobbes.com/api/v1/sessions");
url.searchParams.set("date_from", "2026-07-01T00:00:00Z");
url.searchParams.set("date_to", "2026-07-11T00:00:00Z");
url.searchParams.set("limit", "200");
url.searchParams.set("offset", String(offset));
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.HOBBES_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const payload = await response.json();
const ndjson = payload.sessions.map((session) => JSON.stringify(session)).join("\n");
if (ndjson) await appendFile("hobbes-sessions.ndjson", `${ndjson}\n`);
offset += payload.pagination.limit;
if (offset >= payload.pagination.total) break;
}
Store raw session-list rows first. Enrich selected records with session detail
in a separate step so a detail failure does not force the full list export to restart.