Create Queue

11/30/2016 3 min to read Contributors
  • Tamra Myers
  • sankethka

The Create Queue operation creates a queue under the given account.

Request

The Create Queue request may be constructed as follows. HTTPS is recommended. Replace myaccount with the name of your storage account:

Method Request URI HTTP Version
PUT https://myaccount.queue.core.windows.net/myqueue HTTP/1.1

Emulated Storage Service URI

When making a request against the emulated storage service, specify the emulator hostname and Queue service port as 127.0.0.1:10001, followed by the emulated storage account name:

Method Request URI HTTP Version
PUT http://127.0.0.1:10001/devstoreaccount1/myqueue HTTP/1.1

URI Parameters

The following additional parameters may be specified on the request URI.

Parameter Description
timeout Optional. The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Queue Service Operations.

Request Headers

The following table describes required and optional request headers.

Request Header Description
Authorization Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services.
Date or x-ms-date Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services.
x-ms-version Optional. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage Services.
x-ms-meta-name:value Optional. A name-value pair to associate with the queue as metadata.

Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers.
x-ms-client-request-id Optional. Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. Using this header is highly recommended for correlating client-side activities with requests received by the server. For more information, see About Storage Analytics Logging and Azure Logging: Using Logs to Track Storage Requests.

Request Body

None.

Response

The response includes an HTTP status code and a set of response headers.

Status Code

A successful operation returns status code 201 (Created).

For information about status codes, see Status and Error Codes.

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response header Description
ms-request-id This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations.
x-ms-version Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and later.
Date A UTC date/time value generated by the service that indicates the time at which the response was initiated.

Sample Response

Response Status:  
HTTP/1.1 201 Created  

Response Headers:  
Transfer-Encoding: chunked  
Date: Fri, 16 Sep 2011 01:20:22 GMT  
x-ms-version: 2011-08-18  
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0

Authorization

Only the account owner may call this operation.

Remarks

You can specify user-defined metadata as name-value pairs on the queue at the time that it is created.

When a queue with the specified name already exists, the Queue service checks the metadata associated with the existing queue. If the existing metadata is identical to the metadata specified on the Create Queue request, status code 204 (No Content) is returned. If the existing metadata does not match the metadata provided with the Create Queue request, the operation fails and status code 409 (Conflict) is returned. Clients can take advantage of this behavior to avoid an additional call to check whether a named queue already exists.

For guidance about valid queue names, see Naming Queues and Metadata. If the specified queue name is not a valid name, the Create Queue operation returns status code 400 (Bad Request), along with additional error information, as shown in the following example.

HTTP/1.1 400 One of the request inputs is out of range.  
Connection: Keep-Alive  
Content-Length: 226  
Via: 1.1 TK5-PRXY-22  
Date: Wed, 02 May 2012 17:47:54 GMT  
Content-Type: application/xml  
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: fda2babe-ffbb-4f0e-a11b-2bfbd871ba9f  
x-ms-version: 2011-08-18  

<?xml version="1.0" encoding="utf-8"?>  
<Error>  
   <Code>OutOfRangeInput</Code>  
   <Message>One of the request inputs is out of range.  
   RequestId:fda2babe-ffbb-4f0e-a11b-2bfbd871ba9f  
   Time:2012-05-02T17:47:55.4334169Z</Message>  
</Error>

See Also

Queue Service Error Codes
Authentication for the Azure Storage Services
Status and Error Codes