I’m trying to get media from the REST API of an Omeka S installation by a list of ids.
For a single medium it works out fine: https://myomekasite.org/api/media/95
Is there something as simple as: https://myomekasite.org/api/media/95,96,46,23 or … [95,96,46,23] (these don’t work)?
(Background: In my Vue.js frontend I first fetch a set of items, then I want to get the media attached to these items. If there was a way to include the medium data in the item response that would be a even better solution. Fetching media one by one is not an ideal solution in terms of performance.)
Try ?item=x , so all media attached to this item are fetched. Else, take a look at module ApiInfo, that can help you.
Thanks for your reply! Do you mean something like:
(doesn’t work, gives back all media and would not allow to fetch a set of media items)
Great, thank you, Daniel, this one works.
But it still means I’ve to get medium by medium? What I’m doing is fetching all items with a given page size, say 100. So I have 100 items and the corresponding media ids. Now I want to fetch all these media objects with one single axios get.
With the module ApiInfo, you can set
/api/items?item_set_id=1&append=urls to get the urls of the medias when you fetch the items. There is no way currently to fetch media objects by multiple item id, so you may need to create a module if you need. It’s possible to fetch all media objects anyway. Check the headers, there is a pagination.