Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the representation of the outcome JSON #929

Open
rwilson-ebi opened this issue Mar 8, 2021 · 0 comments
Open

Improve the representation of the outcome JSON #929

rwilson-ebi opened this issue Mar 8, 2021 · 0 comments
Assignees

Comments

@rwilson-ebi
Copy link
Contributor

rwilson-ebi commented Mar 8, 2021

The outcome JSON for an endpoint such as:

https://www.gentar.org/tracker-api/api/plans/PIN:0000006277/outcomes

is missing top level properties i.e. "page" and "_links"

==========================================================

Context: email from 2020-03-08

Hi Gentar Staff,

Alba pointed me towards this endpoint when I was trying to browse outcomes:
https://www.gentar.org/tracker-api/api/plans/PIN:0000006277/outcomes

However, the format seems inconsistent when compared to similar endpoints for other objects. The results are embedded in a list under the '"_embedded" top level key, but there are no other top level keys i.e. "page" and "_links".

When I look at e.g. plans, I know not to expect any embedding/pagination when fetching a single item by primary key:
https://www.gentar.org/tracker-api/api/plans/PIN:0000006277
And I know to expect the results to be embedded, and for the pagination and links data to be present when fetching all results, or searching on field values i.e. anything which could return multiple results and therefore multiple pages:
https://www.gentar.org/tracker-api/api/plans
https://www.gentar.org/tracker-api/api/plans?phenotypingExternalRef=ORIOB

This logic holds true when fetching a single specific outcome by primary key:
https://www.gentar.org/tracker-api/api/plans/PIN:0000006277/outcomes/TPO:000000002050
but not when getting all outcomes for a plan.
https://www.gentar.org/tracker-api/api/plans/PIN:0000006277/outcomes
There could be multiple outcomes, and therefore (although not likely) multiple pages. Even if we could guarantee that there would never be multiple pages on this endpoint, having an embedded results list without the pagination data means it's hard to write universal code that can be used across all endpoints.

Is the lack of "pages" and "_links" an omission, or was there a reason for this?

Thanks very much,

Ruairidh

@rwilson-ebi rwilson-ebi self-assigned this Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant