Hello,
i would like to query, from javascript, all the items that are linked to one, but i don’t know what is the correct syntax.
In the php api we can use: subjectValues , subjectValueTotalCount , and subjectProperties.
but how should an url be structured?
e.g. /api/items/ID?related
I’m not aware of a way to do this in the current release of Omeka, but, in the next release, the API response for a resource will include a @reverse key that contains all resources that are linked to the requested resource. See this pull request.
You can find all items related/linked to a specified item by using the item search/browse endpoint and using the “property” search:
/api/items?property[0][property]=0&property[0][type]=res&property[0][text]=<ID of item>
Passing 0 for the property subkey means to search across all properties, and the res search type means to search for items which link to the resource ID given in the text subkey.
Thanks for both answers!
I was also wondering, if from a given item i want to query all the items it relates to (and not the inverted properties) i could select all the properties which contain "type": "resource" and get their ids.
Consequentially is there a way to make a single api call for all ids? e.g.