Adding Mapping-coordinates to an API Create Item command.

Hi guys,

I am trying to create items in our Omeka S via API call. This is working fine so far. I am testing it with Postman.
But I don’t know how it works with mapping plugin. When I add to my JSON the following it doesn’t work at all:

“o-module-mapping:lat”: 48.84611999699925,
“o-module-mapping:lng”: 8.927738240962093,
“o-module-mapping:label”: “Api-Test: Geo Location”.

When I retrieve an item, I get the following info about the map:

“o-module-mapping:mapping”: {.
@id”: “XXXX/api/mappings/4814”,
“o:id”: 4814
},
“o-module-mapping:marker”: [
{
@id”: “XXXX/api/mapping_markers/5456”,
“o:id”: 5456
}
]

I think I didn’t really understand how the module works. Do I need a separate create command for the mapping module? I would prefer it to work in one go.

I really hope someone knows how this works :slight_smile:

Thank you very much and greetings from Germany,

deniz binay

Have you tried to access the mapping or mapping_marker URLs to see what data they have?

Oh, or are you saying you retrieved an existing item (not one created through the API) and it had that structure? Mapping expects you to supply the data within that same kind of structure when you create or update an item: the lat, lng and label are expected to be within a o-module-mapping:marker top-level key, which is an array of marker objects:

"o-module-mapping:marker": [
    {
        "data for a marker would go here"
    }
]
1 Like

great, this works perfectly. thank you!

“o-module-mapping:marker”: [
{
“o-module-mapping:lat”: 48.84611999699925,
“o-module-mapping:lng”: 8.927738240962093,
“o-module-mapping:label”: “Api-Test: Geo Location”
}