sciapp / sampledb

Sample and Measurement Metadata Database
https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/
MIT License
21 stars 11 forks source link

Get related objects with HTTP-API #51

Closed NilsWeber98 closed 1 year ago

NilsWeber98 commented 1 year ago

In our system, we connected objects of different action types. The connection can be seen in the area "related objects" of both objects, but we are not able to get those related objects from the HTTP-API. Is there a way to achieve this? If so, where is it described?

FlorianRhiem commented 1 year ago

Hey Nils, there are two kinds of related objects:

In the code, get_related_object_ids finds lists for these two categories and build_related_objects_tree constructs the tree structure shown in the related objects section using get_related_object_ids repeatedly. I suspect for your use case, the ID lists for a given object would be sufficient? If so, I think an API route should be added to return these.

NilsWeber98 commented 1 year ago

Hey Florian, thank you for the quick response. Unfortunately, we are looking for objects which are not referenced in the metadata of the current object. An additional API route covering this case would be helpful. Edit: And yes, the ID list would be sufficient.

FlorianRhiem commented 1 year ago

I've implemented this in fedc033b5041dbd732b86a9a6a0eacbc96cd7148, these lists can now be accessed via /api/v1/objects/<object_id>/related_objects.