Skip to content

Upstream quirks

Observed behavior of the live GTR-2 API that its documentation does not spell out, or contradicts.

Paging

  • The page size s must be between 10 and 100. A smaller or larger value answers HTTP 400 with {"text": "Invalid request: Page size cannot be less than 10"}. The client defaults to 20 (the upstream default) and caps page_size at 100; count() requests 10, the smallest legal page.
  • A page number beyond the last page answers HTTP 404, not an empty page. A far larger page number (99,999) answers HTTP 500 with an error reference instead.
  • The envelope reports page, size, totalPages, and totalSize; links and ext are present but null in every observed response.
  • There is no cursor paging; iteration walks page numbers.
  • Unknown query parameters are ignored, not rejected: &zzz=1 answers a normal page. There is no server-side validation to discover filters from, so the only documented filters are q, f (field restriction), sf, and so.
  • The f field restriction takes one field code per repeated parameter (f=pro.t&f=pro.a). The client does not type it; pass params={"f": ["pro.t"]} to use it.
  • sf (sort field) and so (A or D) are two separate parameters; the client splits sort="pro.sd desc" into them.
  • The id query parameter is absent from /configs and upstream ignores it: a request with id=<uuid> returns every project. A batch lookup would therefore fetch unrelated records and silently answer the wrong ids, so the client disables batch_get and raises ConfigurationError before any request; call get() per id.
  • The framework asks first() for a one-record page by default; the API rejects that with HTTP 400, so first() on this client requests a page of 10.

Records

  • created, updated, and every date field (start, end, datePublished, link start/end) are epoch milliseconds.
  • Record ids are UUIDs in upper case, but lookups answer for lower-case ids too.
  • The href values upstream embeds in records and links sometimes contain a double slash (.../gtr/api//outcomes/...). The client builds its own paths and never follows those values.
  • HEAD works on record routes, so exists() is one request.
  • Many free-text fields, including a project's start/end and participantValues, are null in practice; the funded dates live on the fund records.

Outcomes

  • The merged /outcomes route pages a global stream of about 2.5 million records grouped by outcome type in alphabetical order, but neighboring pages repeat most of their records: an observed page 1 and page 2 pair shared 9 of 10 ids. iterate() and collect() therefore raise ConfigurationError on client.outcomes; page it with search(page=...) or use the typed routes, which page cleanly.
  • The per-type route /outcomes/furtherfundings spells its envelope key futherfunding (one "r"), while the merged stream spells the same key furtherFunding. The client reads both.
  • Upstream serves no per-type route for exploitation, other research item, or research database and model outcomes; the routes answer 404. The records still appear in the merged stream. The corresponding client.outcomes attributes raise ConfigurationError on access.
  • Impact summaries are the closest thing to "impacts": there is no /impacts route in this API.
  • clinicalTrial on product outcomes is a boolean on some records and a string on others; the model accepts both. The yes/no fields softwareDeveloped and softwareOpenSourced (research materials and software products) behave the same way.

Errors

  • Transient 503 Service Temporarily Unavailable answers happen under load; the body is an nginx HTML page, not JSON. The framework retry (statuses 429, 500, 502, 503, 504) covers them.
  • The 400 and 404 bodies are small JSON objects, {"text": "...", "timestamp": ...}, with content type application/vnd.rcuk.gtr.json-v7.
  • Status 404 raises bibliofabric.NotFoundError (unknown id, page beyond the last). Status 400 raises bibliofabric.APIError (page size outside 10 to 100).

Metadata

  • The /configs/{resource} routes document the URL parameters and the searchable and sortable field codes; they are typed and wrapped.
  • The upstream documentation (resources/api.html) now redirects to UKRI pages describing a newer v3 API at https://gtr.ukri.org/api/v3. That service has different routes and is out of scope here.