Can't set more than one metadata using OpenStack Swift object

I am trying to set metadata with an object stored in a Swift Container. I am using the following command (note that my container is "container1" and the object is "employee.json":

curl -X POST -H "X-Auth-Token:$TOKEN" -H 'X-Object-Meta-metadata1: value' $STORAGE_URL/container1/employee.json


It works great with one metadata. But whenever I try to set multiple metadata issuing multiple curl commands only the latest metadata value is actually set.

I think there should be no limit that you can only set one metadata for a swift object. Am I doing something wrong?

FYI: I'm using the Havana Openstack Swift edition.



source to share

1 answer

I think I figured it out ... Its bad that I didn't read the documentation sincerely.

It [1] says: "The POST request will remove all existing metadata added with the previous PUT / POST."

So, I tried this and it worked ...

curl -X POST -H "X-Auth-Token:$TOKEN" -H 'X-Object-Meta-p1:[P1]'  -H 'X-Object-Meta-p2:[P1]' $STORAGE_URL/container1/employee.json


Here, instead of two POST requests, I have now set multiple metadata in a single POST request.

Thanks again.




All Articles