New API: How to search second endpoint based on first endpoint

Hello MatSci community,

I have recently switched over to using the new API and I was wondering what the recommended way is to search through a second endpoint once you have narrowed down a search based on a primary endpoint (like the summary endpoint)?
For example, I needed the tags field from the provenance endpoint based on mpids I downselected by searching the primary summary endpoint. The only way I was able to do this was either to do individual requests for each mpid (very slow) or pull the entire provenance endpoint and then filter the results based on the mpids list (which is faster but wastes bandwidth). I wasn’t able to specify search criteria in the provenance endpoint but I might have overlooked something?

Thank you for your input!

Best,
Peter

Hi @peterschindler, for some endpoints there is an ability to search using lists of MPIDs that solves this issue. Provenance (among others) currently does not implement this functionality. However, this is something easily added.

Based on this alongside other similar feedback, I will go ahead and add a material_ids query field to the general search of all endpoints where it is possible and makes sense. For now, the solution is to do exactly what you have done and filter the entire endpoint’s results.

– Jason

1 Like

Hi @munrojm - thanks for the help. That’d be indeed a great addition! :slight_smile:

-Peter

1 Like

Perhaps there’s a pattern we can adopt in the client to make this more seamless?

2 Likes