Developing Solutions for Azure (AZ-204)

Last Updated: 7/9/2024

Manage Properties Using REST

  • Containers and blobs support custom metadata, represented as HTTP headers.
  • Metadata headers can be set on a request that creates a new container or blob resource, or on a request that explicitly creates a property on an existing resource.

Metadata header format

  • Metadata headers are name/value pairs. The format for the header is:
x-ms-meta-name:string-value  
  • Metadata name/value pairs are valid HTTP headers, and so they adhere to all restrictions governing HTTP headers.
  • Metadata names must adhere to the naming rules for C# identifiers.
  • Names are case-insensitive.
  • The total size of all metadata pairs can be up to 8KB in size.
  • If two or more metadata headers with the same name are submitted for a resource, the Blob service returns status code 400 (Bad Request).

Operations on metadata

  • Metadata values can only be read or written in full; partial updates are not supported. Setting metadata on a resource overwrites any existing metadata values for that resource.
GET/HEAD https://myaccount.blob.core.windows.net/mycontainer?restype=container
GET/HEAD https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=metadata

PUT https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=metadata
PUT https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=metadata

Standard HTTP properties for containers and blobs

  • Containers and blobs also support certain standard HTTP properties.
  • Properties and metadata are both represented as standard HTTP headers; the difference between them is in the naming of the headers.
  • Metadata headers are named with the header prefix x-ms-meta- and a custom name.
  • The standard HTTP headers supported on containers include:
    • ETag
    • Last-Modified
  • The standard HTTP headers supported on blobs include:
    • ETag
    • Last-Modified
    • Content-Length
    • Content-Type
    • Content-MD5
    • Content-Encoding
    • Content-Language
    • Cache-Control
    • Origin
    • Range