Conal-Tuohy / TroveProxy

A transforming proxy and harvester for the National Library of Australia's Trove API
Apache License 2.0
1 stars 0 forks source link

Facets are not returned if `facet` parameter contains a comma-separated list #15

Open Conal-Tuohy opened 10 months ago

Conal-Tuohy commented 10 months ago

When querying the Trove API, if the value of the facet URL parameter is a comma-separated list of facet names, then facets are NOT returned in the response, e.g. https://api.trove.nla.gov.au/v3/result?category=newspaper&facet=format,decade ​ The section on facets in the online documentation (the Controlling the metadata returned section) says

You can separate multiple values with commas https://trove.nla.gov.au/about/create-something/using-api/v3/api-technical-guide#parameters-available-when-searching

This does work for other parameters, but not for facet. ​

Conal-Tuohy commented 10 months ago

Libraries Australia reference: RSref164975

Conal-Tuohy commented 10 months ago

If the change to the URL syntax is intended, then there's something that will need to be fixed (apart from the documentation): the API responses include next attributes containing URLs which point to subsequent pages of results, and these URLs have facet parameters whose values are comma-separated lists. i.e. you can start with a query URL like this, which does produce a response containing facets: https://api.trove.nla.gov.au/v3/result?category=newspaper&facet=format&facet=decade The response contains a next value of: https://api.trove.nla.gov.au/v3/result?category=newspaper&facet=format%2Cdecade&s=AoIIP4AAACkxMDAwMDAwNjQ%3D NB the next URL has a single facet parameter containing a comma-separated list, and a response to that URL does not include facet data. That next URL should be returned as: https://api.trove.nla.gov.au/v3/result?category=newspaper&facet=format%2Cdecade&s=AoIIP4AAACkxMDAwMDAwNjQ%3D

Conal-Tuohy commented 10 months ago

Temporary workaround in fd9ac52