inspirehep / rest-api-doc

Documentation of the INSPIRE REST API
https://inspirehep.net
Creative Commons Attribution Share Alike 4.0 International
40 stars 10 forks source link

Endpoint for batch queries #5

Open duetosymmetry opened 4 years ago

duetosymmetry commented 4 years ago

I think it would be useful if there was a (POST) endpoint, e.g. /api/batch, where several queries could be batched together. Similar to how the page BiblioTools: Generating Your Bibliography allows one to get batch bibtex responses from a list of keys, this should be possible through an API endpoint.

michamos commented 4 years ago

We are currently porting the bibliography generation tools to the new platform, so we could expose its API once it's done. Would that work for you or do you have something more general in mind?

duetosymmetry commented 4 years ago

That could possibly work for the use case I had in mind, but I was thinking more generally. For example, the tool filltex makes queries to INSPIRE, one for each bibkey. With a batch endpoint, all of those queries could be combined into one request.

michamos commented 4 years ago

Note that you can already get results for several queries by using (query1) OR (query2) OR (query3) etc., instead of doing those queries separately. This only works if you don't care which queries caused a given record to appear in the result or can independently figure it out, but that seems to be the case for this class of tools.

We'll keep your suggestion in mind for future improvements to the API, but it probably won't be happening very soon as the current priority is to add all missing features to the new website so we can switch off the old one.

duetosymmetry commented 4 years ago

That is a useful suggestion, thanks @michamos. I was just writing up a tool last night (ads2inspire) where I needed to keep track of which result came from which query. It should be possible with an OR query and some extra post-processing, but it would be simpler with a batch query approach. I'll stay tuned!