Describe your issue in detail
Hi all!
POST /a/meta/get/{NodePath} works ok to get metadata info for a file…
I can get metadata info for a file using https://localhost:8123/a/meta/get/common-files/Filename.mp4
{
“Uuid”: “9061b329-e5d1-4db3-833e-1b3aae378123”,
“Path”: “common-files/Filename.mp4”,
“Type”: “LEAF”,
“Size”: “15628037”,
“MTime”: “1750327123”,
“Etag”: “c531d9763e5b0a0be5c4a646bbae6123”,
“MetaStore”: {
“hashing_version”: “"v4"”,
“mime”: “"video/mp4"”,
“name”: “"Filename.mp4"”,
“usermeta-photographer”: “"photographers name here"”,
“x-cells-hash”: “"8a4ab0f3fe4afe1aac51c6ca400d0123"”
}
}
How do you use POST /a/meta/set/{NodePath} to set/update metadata??
When hitting “https://localhost:8123/a/meta/set/common-files/Filename.mp4” I just keep getting API responses like:
{
“Title”: “proto: (line 2:5): unknown field "MetaStore"”,
“Detail”: “proto: (line 2:5): unknown field "MetaStore"”
}
no matter which way I try and set the JSON payload.
Is there some other protobuf way that we’re meant to POST to the /a/meta/set/{NodePath} endpoint in order to update metadata values for certain namespaces?
What version of Cells are you using?
Home
Thanks!
Steve.
Ok I managed to get halfway there after diving through the code:
POST /a/meta/set/{NodePath}
Endpoint:
https://localhost:8123/a/meta/set/common-files/Filename.mp4
Header:
Content-Type: application/json
Body JSON:
{
“Metadatas”: [
{
“Namespace”: “usermeta-photographer”,
“JsonMeta”: “{"usermeta-photographer":"new Photographer Name"}”
}
]
}
^^^ This works if the metadata/namespace value hasn’t been set already from the app frontend, as soon as that happens then this API call will not change the metadata.
Interestingly, if you upload a fresh file, make the above web request, the metadata update is reflected in the frontend app - BUT - it isn’t added to the idm_usr_meta d/b table (it’s added to the data_meta d/b table). If you make a metadata update from the frontend app, then the row is added/updated within the idm_usr_meta table.
It looks like if you edit custom namespace metadata from the frontend app, it add/updates a row in the idm_usr_meta d/b table. And if you add/update namespace metadata from the REST API /a/meta/set/ it updates the data_meta d/b table. If there is a row in the idm_usr_meta d/b table then this value is always displayed and the metadata value from the data_meta d/b table isn’t shown unless the row from the idm_usr_meta d/b table is deleted (and pydio cells then restarted).
So, I wonder what the best way is to handle updating metadata/namespace values via web requests?
Ok, I see the different API endpoints now:
To update raw file metadata (default metadata values that are stored in the data_meta d/b table like imageheight, name etc), then use the POST /a/meta/set/{NodePath} endpoint, with Body payload like:
{
“Metadatas”: [
{
“Namespace”: “<namespace_name>”,
“JsonMeta”: “{“<namespace_name>”:“new value”}”
}
]
}
To update custom (user metadata namespaces), then use PUT https://localhost:8123/a/user-meta/update endpoint with a Body payload like:
{
“MetaDatas”: [
{
“JsonValue”: “{\“usermeta-photographer\”:\“new foto name\”}”,
“Namespace”: “usermeta-photographer”,
“NodeUuid”: “f6450ab6-0951-4c81-a7b6-46fd63c0a123”
}
],
“Operation”: “PUT”
}
(“Operation” is allowed to be PUT or DELETE)
Slightly different as you’ll need to first get/know the UUID of the file you’re updating the metadata for. But this way I’ve tested working with a file that has the metadata updated from the frontend webapp and/or programmatically via the API web request.