locked
how to create documentdb resource account using rest api RRS feed

  • Question

  • hi

    can anyone help me.. since a day i am going through various links in https://msdn.microsoft.com/en-
    us/library/azure/mt420159.aspx  but not able to find solution of creating documentdb resouce account.

    Thanks


    Tuesday, September 13, 2016 6:07 AM

Answers

  • Hi Bhushan-

    I am working on adding this content to the site as we speak. Here is the info you're looking for, and it will be available on MSDN within the next few days.

    Create or Update DocumentDB Account

    The Create or Update DocumentDB Account operation creates a new DocumentDB account with the specified parameters.  If an account was already created and a subsequent PUT request is issues with different properties, then the account will be updated.  

    Request

    Method: PUT 

    Request URI: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}?api-version={api-version}

     

    Request URI Parameters

    Parameter | Description

    subscriptionId The subscriptionId for the Azure user.

    resourceGroupName The name of the resource group within the user’s subscription.

    accountName The name of the DocumentDB account within the specified resource group.

    api-version Specifies the version of the protocol used to make this request. The currently supported version is 2015-04-08.

     

    Request Headers

    Header | Description 

    Content-type Set this header to application/json Required

    x-ms-client-request-id Caller-specified request ID, in the form of a GUID with no decoration such as curly braces. If specified, this will be included in response information as a way to map the request. Optional

    x-ms-return-client-

    request-id True or false. Indicates if a client-request-id should be returned in the response. Optional

    Accept-Language Specifies the preferred language for the response when generating error messages Optional

     

    Request Body

    {

        "location": "West US",

        "tags": {

          "key": "value"

        }

     

        "properties": {    “databaseAccountOfferType”:”Standard”,

                  “consistencyPolicy”:{

       “defaultConsistencyLevel”:“Eventual|Session|BoundedStaleness|Strong”,                      “maxStalenessPrefix”: 100,                      “maxStalenessIntervalInSeconds: 10

           }

    },     “kind”: “DocumentDB|MongoDB|Parse”

    }

    Request Body Parameters

    Header Description 

    location The location of the resource. This will be one of the supported and registered Azure Geo Regions. Required

    tags A list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).  A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. Optional

    databaseAccountOfferType  Optional

    defaultConsistencyLevel Sets the default consistency level and configuration settings for a DocumentDB account. Optional

    maxStalenessPrefix When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647.  Optional

    maxStalenessIntervalInSeconds When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 1 - 100. Optional

    kind Indicates the type of DocumentDB account: either ‘DocumentDB’, ‘MongoDB’, or ‘Parse’. Optional

     

    Response

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

    Status Code

    200 (OK) returned to indicate that the operation will complete asynchronously. 

     

    400 (Bad Request) is returned when the request contains malformed syntax.

    403 (Forbidden) is returned if the requested Is not authorized to create this resource in the subscription or resource group  

    404 (NotFound) is returned when the subscription or the resource group does not exist  

    Response Headers

    Headers | Value

    Content-Location 

    Content-Type application/json

    x-ms-request-id [system-operation-tracking-id] 

     Response Body

    EMPTY

    -Mimi


    Tuesday, September 13, 2016 6:25 AM
  • If you are just interested in programmatically manage Azure DocumentDB account resource you can refer the following.

    https://azure.microsoft.com/en-us/documentation/articles/documentdb-automation-resource-manager-cli/#deploy-documentdb-from-a-template


    Karthik

    • Marked as answer by Han, MSFT Friday, September 30, 2016 10:41 PM
    Tuesday, September 13, 2016 3:21 PM

All replies

  • Hi Bhushan-

    I am working on adding this content to the site as we speak. Here is the info you're looking for, and it will be available on MSDN within the next few days.

    Create or Update DocumentDB Account

    The Create or Update DocumentDB Account operation creates a new DocumentDB account with the specified parameters.  If an account was already created and a subsequent PUT request is issues with different properties, then the account will be updated.  

    Request

    Method: PUT 

    Request URI: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}?api-version={api-version}

     

    Request URI Parameters

    Parameter | Description

    subscriptionId The subscriptionId for the Azure user.

    resourceGroupName The name of the resource group within the user’s subscription.

    accountName The name of the DocumentDB account within the specified resource group.

    api-version Specifies the version of the protocol used to make this request. The currently supported version is 2015-04-08.

     

    Request Headers

    Header | Description 

    Content-type Set this header to application/json Required

    x-ms-client-request-id Caller-specified request ID, in the form of a GUID with no decoration such as curly braces. If specified, this will be included in response information as a way to map the request. Optional

    x-ms-return-client-

    request-id True or false. Indicates if a client-request-id should be returned in the response. Optional

    Accept-Language Specifies the preferred language for the response when generating error messages Optional

     

    Request Body

    {

        "location": "West US",

        "tags": {

          "key": "value"

        }

     

        "properties": {    “databaseAccountOfferType”:”Standard”,

                  “consistencyPolicy”:{

       “defaultConsistencyLevel”:“Eventual|Session|BoundedStaleness|Strong”,                      “maxStalenessPrefix”: 100,                      “maxStalenessIntervalInSeconds: 10

           }

    },     “kind”: “DocumentDB|MongoDB|Parse”

    }

    Request Body Parameters

    Header Description 

    location The location of the resource. This will be one of the supported and registered Azure Geo Regions. Required

    tags A list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).  A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. Optional

    databaseAccountOfferType  Optional

    defaultConsistencyLevel Sets the default consistency level and configuration settings for a DocumentDB account. Optional

    maxStalenessPrefix When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647.  Optional

    maxStalenessIntervalInSeconds When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 1 - 100. Optional

    kind Indicates the type of DocumentDB account: either ‘DocumentDB’, ‘MongoDB’, or ‘Parse’. Optional

     

    Response

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

    Status Code

    200 (OK) returned to indicate that the operation will complete asynchronously. 

     

    400 (Bad Request) is returned when the request contains malformed syntax.

    403 (Forbidden) is returned if the requested Is not authorized to create this resource in the subscription or resource group  

    404 (NotFound) is returned when the subscription or the resource group does not exist  

    Response Headers

    Headers | Value

    Content-Location 

    Content-Type application/json

    x-ms-request-id [system-operation-tracking-id] 

     Response Body

    EMPTY

    -Mimi


    Tuesday, September 13, 2016 6:25 AM
  • If you are just interested in programmatically manage Azure DocumentDB account resource you can refer the following.

    https://azure.microsoft.com/en-us/documentation/articles/documentdb-automation-resource-manager-cli/#deploy-documentdb-from-a-template


    Karthik

    • Marked as answer by Han, MSFT Friday, September 30, 2016 10:41 PM
    Tuesday, September 13, 2016 3:21 PM