Set Item ID on creation via API POST?

Relatively new to the inner workings of Omeka-S, and its API, but wondering if it’s possible to set the Item id when issuing a POST request? As in, the primary key id in the database for the item, not just a metadata field?

Tried issuing a POST with a JSON body that included o:id and @id, but both were ignored. Also, tried POSTing to /api/items/ID_HERE, but that didn’t work either.

Realize it’s a bit unorthodox, and we’d be responsible for id collisions, but it would be nice to have that option.

We are migrating from an Omeka classic instance to Omeka-S, and for a variety of reasons, it would be hugely beneficial to maintain the original ids for each item. Using the Omeka-S importer, and had thought it might be possible to hack at that to allow using the old – “remote” – id as the new one, but not having much luck there.

Any thoughts or suggestions would be much appreciated!

thanks,
Graham

Should it be of interest to others, working on an extremely hacky workaround:

  1. create stub Items through id range needed
  2. use PUT requests to surgically update Item stubs, where you can define the id
  3. delete what is not needed (in this case, ids not part of the list)

It’s ugly, but workable for this unique situation.

-Graham

1 Like

This is exactly why I created the module Upgrade To Omeka S and why I recommend always to have your own unique identifiers.

Blast! Wish I would have stumbled on this sooner, that looks extremely closely aligned with our goals. This is great to know about though, and will share with others if they intend to undertake the same.