refactor to conform to json-api document standard
Description
It was suggested that QA be refactored to conform to the json-api document standard.
Rationale
Samvera community is committed to using industry standards when available.
Before and After changes
The json-api format would change the current format used for QA.
Search Results
BEFORE
[ { id: 1, label: "example title" } ]
AFTER
{
data: [ { id: 1, label: "example title" } ]
}
For linked data module with optional performance data and header response
BEFORE
{
performance_data: { ... }
response_header: {
start_record: 31 # the number of the first record returned
requested_records: 10 # the number of records requested (aka page size)
retrieved_records: 10 # the actual number of records returned in this request
total_records: 85 # the total number of matches for this search request
}
results: [ { uri: "http://example.com/1", id: 1, label: "example title" } ]
}
AFTER
{
meta: { performance_data: { ... } }
links: {
pagination: {
first: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=21&page[limit]=10
last: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=81&page[limit]=10
prev: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=11&page[limit]=10
next: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=31&page[limit]=10
}
}
data: [ { uri: "http://example.com/1", id: 1, label: "example title" } ]
}
Missing from this is the total count of records. More exploration is required to determine the best location to include this information.
Fetch/Show results
BEFORE
# results for a single term -- format varies by authority
AFTER
{
data: # results for a single term -- format varies by authority
}
This would be a backwards-incompat change for current users of qa.
Maybe a transition period, where the current responses are still available at the current paths, backwards-compatibly, but there's another path where the json-api responses could be retrieved from?