Choose the observation unit#
Social rows are repeated sampled list appearances. Indicator raw rows are collection observations. Documents are one record per source URL; each collection of that URL is an observation, counted in observation_count and listed in the record detail.
curl --fail-with-body --silent --show-error --max-time 30 "https://china-snapshot.com/api/datasets?dataset=social&limit=5"import json
from urllib.request import Request, urlopen
request = Request('https://china-snapshot.com/api/datasets?dataset=social&limit=5')
with urlopen(request, timeout=30) as response:
data = json.load(response)
print(json.dumps(data, ensure_ascii=False))const response = await fetch("https://china-snapshot.com/api/datasets?dataset=social&limit=5");
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Pagination is a bounded walk#
Use the same query with next_cursor until it is null. Date and ID descend. row_count is the current page size. The cursor carries a query snapshot and row boundary; it is not an immutable version of every field.
Indicator releases#
Use dataset=indicators with mode=release to collapse captures by series_id and period. first_seen_at and last_seen_at describe capture history. revised compares the first and latest captured monthly or policy print; daily quotes carry null.
curl --fail-with-body --silent --show-error --max-time 30 "https://china-snapshot.com/api/datasets?dataset=indicators&mode=release&series=cpi-yoy&limit=5"import json
from urllib.request import Request, urlopen
request = Request('https://china-snapshot.com/api/datasets?dataset=indicators&mode=release&series=cpi-yoy&limit=5')
with urlopen(request, timeout=30) as response:
data = json.load(response)
print(json.dumps(data, ensure_ascii=False))const response = await fetch("https://china-snapshot.com/api/datasets?dataset=indicators&mode=release&series=cpi-yoy&limit=5");
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Document observation history#
List rows carry first_seen, last_seen, observation_count, change_type (new, newly_discovered or revised), version_count, last_revised_at and content_hash. Retrieve one record by id for observations[] and revisions[]: revisions are content hashes of retained versions, so they show that a body changed and when it was observed, not the private text of each version. Rolling out: the change feed, the document observation fields and revisions[] answer once database migration 043 is applied on a deployment. Before that, /api/changes and mode=changes answer HTTP 503 with code unavailable ("not yet enabled"), and list rows return the pending fields as null, named in unavailable_fields.
Coming soon: publishing the text of each historical body version. Only hashes are public.