To modify an item’s element via the API (I am using JS), I’m supposed to use the “PUT” method, provide the item ID, element ID and the actual modification.
What if an item has two entries for the same element (like in the picture). How can I “tell” the API which entry I want to modify?
You’re just doing a PUT to the Item resource?
Element text data you specify in a PUT to the API replaces the existing elements in their entirety. In other words, you don’t really modify one, you just specify both values as you want them to be (one changed, one unchanged).
Indeed… as I gained more knowledge i figured out that if I want to replace a single element belonging to one item, I have to pass it as a parameter to my PUT in it’s entirety with that only element change. Kinda redundant, but well…
For example if I want to change the title (element_id = 50) for a whatever item (let’s say item_id = 344), I cannot say PUT ‘my new edited title’ as element_id=50 for item item_id=344.
I have to transmit the entire item (it’s old state) with the title changed
One other thing… do you have an idea for a quick fix to disable cache in communicating through the API?
I am using the js Omeka API client. And caching is inevitable. If I add the cache: false setting, the server rejects my request, as there is a new parameter in my request query, not recognized
I missed this message, sorry about that.
What specifically do you mean by caching? Omeka itself doesn’t do a whole lot in terms of caching. Your client might, but changing anything about that wouldn’t involve different parameters being sent to the Omeka server.
Indeed, caching is performed by the web server and the client. I had to disable the server’s caching option so that communication always involves ‘fresh’ data.
TL;DR: I fixed my no-cache need independently of Omeka