OneZoom / OZtree

OneZoom Tree of Life Explorer
Other
91 stars 20 forks source link

`getOTT` API endpoint does not default to a JSON representation #867

Open fwimp opened 3 months ago

fwimp commented 3 months ago

All API endpoints default to a JSON view by default except for the getOTT endpoint, however this is not documented in the API documentation.

Whilst I can hack around this myself, it'd possibly be better to have this either documented with the correct API path (API/getOTT.json) or to have the controller default to a JSON-formatted response instead.

It looks like this JSON default is implemented in other endpoints such as otts2vns using the following code:

https://github.com/OneZoom/OZtree/blob/889026e68377ae306e8f3ffc60e16223803420cc/controllers/API.py#L693-L695

hyanwong commented 2 months ago

Yes, we should copy the others here. Probably best to check where we use getOTT first, though. Maybe this was some performance-related hack.

lentinj commented 2 months ago

We don't directly, AFICS. In fact the code had entirely rotted until (relatively) recently: https://github.com/OneZoom/OZtree/issues/526

There's no disadvantage to adding something like the above, https://www.onezoom.org/API/getOTT gets you an invalid view error message, so can't be useful to any existing users. Add away!

Somewhat unrelated, but is there an integration test script for roz? Something where I can do exercise_roz_api.R https://my-local-oz.com/ to ensure any future releases don't break the API would be very useful (feel free to move this to whichever repository is appropriate).

fwimp commented 2 months ago

There is not at present, but that sounds like a good idea!

I'll write some sort of integration test script, I guess in roz/tools/.

roz issue tracking this is here: https://github.com/fwimp/roz/issues/1

If there's any requirements/desirables you have for it then feel free to add them to that issue, otherwise I'll just do the sort of thing that I'd want to see.

fwimp commented 2 months ago

There is now a sort of integration test script in roz (see https://github.com/fwimp/roz/issues/1). Hopefully that's a start, and I can add checks to it in the scenario that we find thing that break and flew under the radar of this.