Upstream quirks
Observed behavior of the live GTR-2 API that its documentation does not spell out, or contradicts.
Paging
- The page size
smust 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 capspage_sizeat 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, andtotalSize;linksandextare present but null in every observed response. - There is no cursor paging; iteration walks page numbers.
Search
- Unknown query parameters are ignored, not rejected:
&zzz=1answers a normal page. There is no server-side validation to discover filters from, so the only documented filters areq,f(field restriction),sf, andso. - The
ffield restriction takes one field code per repeated parameter (f=pro.t&f=pro.a). The client does not type it; passparams={"f": ["pro.t"]}to use it. sf(sort field) andso(AorD) are two separate parameters; the client splitssort="pro.sd desc"into them.- The
idquery parameter is absent from/configsand upstream ignores it: a request withid=<uuid>returns every project. A batch lookup would therefore fetch unrelated records and silently answer the wrong ids, so the client disablesbatch_getand raisesConfigurationErrorbefore any request; callget()per id. - The framework asks
first()for a one-record page by default; the API rejects that with HTTP 400, sofirst()on this client requests a page of 10.
Records
created,updated, and every date field (start,end,datePublished, linkstart/end) are epoch milliseconds.- Record ids are UUIDs in upper case, but lookups answer for lower-case ids too.
- The
hrefvalues 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. HEADworks on record routes, soexists()is one request.- Many free-text fields, including a project's
start/endandparticipantValues, are null in practice; the funded dates live on the fund records.
Outcomes
- The merged
/outcomesroute 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()andcollect()therefore raiseConfigurationErroronclient.outcomes; page it withsearch(page=...)or use the typed routes, which page cleanly. - The per-type route
/outcomes/furtherfundingsspells its envelope keyfutherfunding(one "r"), while the merged stream spells the same keyfurtherFunding. 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.outcomesattributes raiseConfigurationErroron access. - Impact summaries are the closest thing to "impacts": there is no
/impactsroute in this API. clinicalTrialon product outcomes is a boolean on some records and a string on others; the model accepts both. The yes/no fieldssoftwareDevelopedandsoftwareOpenSourced(research materials and software products) behave the same way.
Errors
- Transient
503 Service Temporarily Unavailableanswers 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 typeapplication/vnd.rcuk.gtr.json-v7. - Status 404 raises
bibliofabric.NotFoundError(unknown id, page beyond the last). Status 400 raisesbibliofabric.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 athttps://gtr.ukri.org/api/v3. That service has different routes and is out of scope here.