Modify multiple input metadata elements through API "PUT"

Hi all,

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?

Thanks!

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 :stuck_out_tongue: 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.

Hi,

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.

For example: if I make two consecutive ajax (javascript) calls for the same resource, the second call might return cached data. You can prevent this by declaring each ajax call as unique. This is done by adding a new unique parameter in the ajax function (for example the value of the time in that moment). But the Omek API does not recognize such parameters and will return an invalid call message.

TL;DR: I fixed my no-cache need independently of Omeka