| Verb | URI | Description | |||
| PUT | /servers/id/metadata |
Sets metadata for the specified server. | |||
| PUT | /images/id/metadata |
Sets metadata for the specified image. | |||
Normal Response Code: 200
Error Response Codes: computeFault (400, 500, …), badRequest (400), unauthorized (401), forbidden (403), itemNotFound (404), Method Not Allowed (405), buildInProgress (409), overLimit (413), badMediaType (415), serviceUnavailable (503)
Sets metadata for the specified server or image.
Specify the server or image ID as
id in the URI.
In the request body, specify the
metadata element followed
by attributes.
The following table describes the attributes that you can set in the request body:
| Attribute | Description | Required |
|---|---|---|
| meta |
Key and value pairs for metadata. |
Yes |
Existing metadata items are replaced with the ones provided in the request regardless of the names of the original metadata items.
If you exceed the maximum number of metadata items, the call throws an overLimit (413) fault.
You can query the maximum number of key-value pairs
that can be supplied for each server through the
maxServerMeta absolute limit.
You can query the maximum number of key-value pairs
for an image through the
maxImageMeta absolute limit.
See Section 1.9.3, “Get Limits”.
Example 2.70. Set Metadata: XML Request
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://docs.openstack.org/compute/api/v1.1">
<meta key="Label">Web</meta>
<meta key="Version">2.1</meta>
</metadata>
Example 2.71. Set Metadata: XML Response
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://docs.openstack.org/compute/api/v1.1">
<meta key="Label">Web</meta>
<meta key="Version">2.1</meta>
</metadata>

