Service Operations
Get Service Statistics
Retrieves the storage account statistics. This includes the number of services, capacities, and resource counts.
Request
This operation does not have a request body.
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
comp |
Query | Specifies the operation to perform. Must be set to stats. |
Yes | String |
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
Response
A successful response returns status code 200 OK. The response body contains statistics about the storage account.
Success Response (200 OK)
<StorageStats xmlns="http://schemas.microsoft.com/ado/2013/11/storage/analytics">
<CapacityInBytes>1024000000000</CapacityInBytes>
<UsedCapacityInBytes>512000000000</UsedCapacityInBytes>
<Resources>
<FileCount>1000000</FileCount>
<DirectoryCount>500000</DirectoryCount>
<TotalFileSizeBytes>500000000000</TotalFileSizeBytes>
</Resources>
</StorageStats>
Response Headers
| Header | Description |
|---|---|
x-ms-request-id |
The request ID for this operation. |
x-ms-version |
Specifies the version of the REST API used for the request. |
Date |
The date and time the request was processed. |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Set Service Logging
Configures logging settings for the storage service.
Request
The request body specifies the logging configuration.
<StorageServiceLogging xmlns="http://schemas.microsoft.com/ado/2013/11/storage/analytics">
<Logging>true</Logging>
<Delete>true</Delete>
<Read>false</Read>
<Write>true</Write>
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>7</Days>
</RetentionPolicy>
</StorageServiceLogging>
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to logging. |
Yes | String |
Request Body
| Element | Description |
|---|---|
Logging |
Specifies whether to enable logging. If true, logging is enabled. |
Delete |
Specifies whether to log delete operations. |
Read |
Specifies whether to log read operations. |
Write |
Specifies whether to log write operations. |
RetentionPolicy |
Configures the retention policy for log files. |
RetentionPolicy/Enabled |
Specifies whether the retention policy is enabled. |
RetentionPolicy/Days |
The number of days to retain log files. Valid values are 0 to 365. If Days is 0, then the logs are not deleted. |
Response
A successful response returns status code 204 No Content.
Success Response (204 No Content)
No response body is returned.
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 409 | Conflict - The specified resource already exists or an invalid state was detected. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Get Service Logging
Retrieves the current logging settings for the storage service.
Request
This operation does not have a request body.
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to logging. |
Yes | String |
Response
A successful response returns status code 200 OK. The response body contains the current logging configuration.
Success Response (200 OK)
<StorageServiceLogging xmlns="http://schemas.microsoft.com/ado/2013/11/storage/analytics">
<Logging>true</Logging>
<Delete>true</Delete>
<Read>false</Read>
<Write>true</Write>
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>7</Days>
</RetentionPolicy>
</StorageServiceLogging>
Response Headers
| Header | Description |
|---|---|
x-ms-request-id |
The request ID for this operation. |
x-ms-version |
Specifies the version of the REST API used for the request. |
Date |
The date and time the request was processed. |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Set Service CORS
Configures Cross-Origin Resource Sharing (CORS) rules for the storage service.
Request
The request body specifies the CORS rules.
<StorageServiceCors xmlns="http://schemas.microsoft.com/ado/2013/11/storage">
<Cors>
<CorsRule>
<AllowedOrigins>http://www.contoso.com,http://www.fabrikam.com</AllowedOrigins>
<AllowedMethods>GET,PUT,POST,DELETE,OPTIONS</AllowedMethods>
<AllowedHeaders>x-ms-version,x-ms-date,content-type,accept</AllowedHeaders>
<ExposedHeaders>x-ms-request-id,x-ms-version,content-length,date</ExposedHeaders>
<MaxAgeInSeconds>86400</MaxAgeInSeconds>
</CorsRule>
<CorsRule>
<AllowedOrigins>*</AllowedOrigins>
<AllowedMethods>GET,OPTIONS</AllowedMethods>
<MaxAgeInSeconds>0</MaxAgeInSeconds>
</CorsRule>
</Cors>
</StorageServiceCors>
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to cors. |
Yes | String |
Request Body
| Element | Description |
|---|---|
Cors |
The collection of CORS rules. |
Cors/CorsRule |
A single CORS rule. |
CorsRule/AllowedOrigins |
Specifies the origins that are allowed to make a request against the storage service. '*' is a wildcard value that allows all origins. |
CorsRule/AllowedMethods |
Specifies the HTTP methods that are allowed to be used in a request. |
CorsRule/AllowedHeaders |
Specifies the HTTP headers that are allowed in a request. |
CorsRule/ExposedHeaders |
Specifies the HTTP headers that can be sent in the response to the client. |
CorsRule/MaxAgeInSeconds |
Specifies the maximum amount of time that a user agent should cache a preflight OPTIONS request. |
Response
A successful response returns status code 204 No Content.
Success Response (204 No Content)
No response body is returned.
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Get Service CORS
Retrieves the current CORS rules for the storage service.
Request
This operation does not have a request body.
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to cors. |
Yes | String |
Response
A successful response returns status code 200 OK. The response body contains the current CORS configuration.
Success Response (200 OK)
<StorageServiceCors xmlns="http://schemas.microsoft.com/ado/2013/11/storage">
<Cors>
<CorsRule>
<AllowedOrigins>http://www.contoso.com,http://www.fabrikam.com</AllowedOrigins>
<AllowedMethods>GET,PUT,POST,DELETE,OPTIONS</AllowedMethods>
<AllowedHeaders>x-ms-version,x-ms-date,content-type,accept</AllowedHeaders>
<ExposedHeaders>x-ms-request-id,x-ms-version,content-length,date</ExposedHeaders>
<MaxAgeInSeconds>86400</MaxAgeInSeconds>
</CorsRule>
<CorsRule>
<AllowedOrigins>*</AllowedOrigins>
<AllowedMethods>GET,OPTIONS</AllowedMethods>
<MaxAgeInSeconds>0</MaxAgeInSeconds>
</CorsRule>
</Cors>
</StorageServiceCors>
Response Headers
| Header | Description |
|---|---|
x-ms-request-id |
The request ID for this operation. |
x-ms-version |
Specifies the version of the REST API used for the request. |
Date |
The date and time the request was processed. |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Set Service Retention Policy
Configures the retention policy for blob versioning or soft delete.
Request
The request body specifies the retention policy configuration.
<StorageServiceRetentionPolicy xmlns="http://schemas.microsoft.com/ado/2013/11/storage">
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>30</Days>
</RetentionPolicy>
</StorageServiceRetentionPolicy>
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to retention. |
Yes | String |
Request Body
| Element | Description |
|---|---|
RetentionPolicy |
Configures the retention policy. |
RetentionPolicy/Enabled |
Specifies whether the retention policy is enabled. |
RetentionPolicy/Days |
The number of days to retain versions or deleted blobs. Valid values are 1 to 365. |
Response
A successful response returns status code 204 No Content.
Success Response (204 No Content)
No response body is returned.
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |
Get Service Retention Policy
Retrieves the current retention policy for blob versioning or soft delete.
Request
This operation does not have a request body.
Parameters
| Name | In | Description | Required | Type |
|---|---|---|---|---|
restype |
Query | Specifies the resource type. Must be set to service. |
Yes | String |
comp |
Query | Specifies the operation to perform. Must be set to retention. |
Yes | String |
Response
A successful response returns status code 200 OK. The response body contains the current retention policy configuration.
Success Response (200 OK)
<StorageServiceRetentionPolicy xmlns="http://schemas.microsoft.com/ado/2013/11/storage">
<RetentionPolicy>
<Enabled>true</Enabled>
<Days>30</Days>
</RetentionPolicy>
</StorageServiceRetentionPolicy>
Response Headers
| Header | Description |
|---|---|
x-ms-request-id |
The request ID for this operation. |
x-ms-version |
Specifies the version of the REST API used for the request. |
Date |
The date and time the request was processed. |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - The request is malformed or invalid. |
| 500 | Internal Server Error - An unexpected error occurred on the server. |