3

I am trying to set metadata with a Object stored in Swift Container. I am using following command (note that my container is 'container1' and 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 fine with one metadata. But whenever, I am trying to set more than one metadata issuing several curl commands, only the last metadata value is actually set.

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

FYI: I am using Havana release of Openstack Swift.

Thank you.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
Prosunjit Biswas
  • 935
  • 9
  • 16

1 Answers1

4

I think, I have figured it out... Its my bad that I did not read documentation sincerely.

It [1] says, "A POST request will delete all existing metadata added with a 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, now I have set multiple metadata in a single POST request.

Again, thanks.

Ref:

  1. http://docs.openstack.org/api/openstack-object-storage/1.0/content/update-object-metadata.html
Prosunjit Biswas
  • 935
  • 9
  • 16