headers
headers
#
HTTP header names and codecs for the CaptureGraph captured-data file API.
The API's governing convention: when a message body carries raw file bytes, its accompanying metadata travels in HTTP headers; otherwise it travels in the JSON body. The raw-body routes are the single-file transfers:
GET files/{path}response: the bytes' extension inX-CG-File-Extensionand content version in the standardETag(a matchingIf-None-Matchyields304 Not Modified).PUT files/{path}request: the bytes are the body; the claimed extension rides inX-CG-File-Extension.
Orthogonally, every request carries its optional caller profile —
X-CG-User-Id and X-CG-Location — so identity and place stay out of file
identity entirely. All custom headers are CG-namespaced. Shared by
capturegraph-server (sets/reads them) and capturegraph-sync (reads them); the iOS
client mirrors them in CGHTTPHeader.
decode_location(value)
#
Decode an X-CG-Location header value; raise ValueError if malformed.
Source code in capturegraph-lib/capturegraph/api_models/headers.py
encode_location(location)
#
Encode a caller location as the X-CG-Location header value.
Four comma-separated decimals in a fixed order,
"{latitude},{longitude},{altitude_meters},{heading_degrees}" — the WGS84
fields of the edu.cornell.location value.