Azure CosmosDB

Discover more about the Azure CosmosDB connector and how to use it on the Digibee Integration Platform.

Azure CosmosDB reads and writes records to the CosmosDB database on Azure cloud platform.

This connector supports only NoSQL databases. For MongoDB databases, please use the MongoDB connector.

Parameters

Take a look at the configuration parameters for the connector. Parameters supported by Double Braces expressions are marked with (DB).

General tab

Parameter
Description
Default value
Data type

Account

N/A

Account

Database Endpoint (DB)

The Azure Cosmos database endpoint to which the connector will connect.

N/A

String

Operation

The CosmosDB operation to be used. Options are:

  • Create Item

  • Delete Item

  • Query Items

  • Read Item

  • Replace Item

  • Upsert Item

Create Item

String

Database Name (DB)

The name of the Cosmos database to which the connector should connect.

N/A

String

Container Name (DB)

The name of the Cosmos container to which the connector should connect.

N/A

String

Query (DB)

SQL query type. Available on Query Items operation.

N/A

String

Container Partition Key Path (DB)

The container partition key path. Available on Create Item operation.

N/A

String

Item Id (DB)

The item ID. Available on Delete Item, Read Item, and Replace Item operations.

N/A

String

Item Partition Key (DB)

The partition key value in the Azure CosmosDB database service. A partition key identifies the partition in which the item is stored. Available on Create Item, Delete Item, Read Item, Replace Item, and Upsert Item operations.

N/A

String

Body (DB)

The request body. Available on Create Item, Replace Item, and Upsert Item operations.

{{ message.$ }}

JSON

Fail On Error

If the option is activated, the pipeline's execution with an error will be interrupted. Otherwise, the pipeline execution proceeds, but the result will show a false value for the "success" property.

False

Boolean

Optional tab

Parameter
Description
Default value
Data type

Consistency Level

Session

String

Client Telemetry Enabled

Enables telemetry to gather statistics on database operations and system data (for example, CPU and memory) at regular intervals, aiding in troubleshooting.

False

Boolean

Connection Sharing Across Clients Enabled

Allows multiple Cosmos customers within the same JVM to share connections in Direct mode when accessing multiple Cosmos accounts. Note: connection settings of the first customer will apply to all other customers.

False

Boolean

Content Response On Write Enabled

If enabled, Cosmos DB responses for Create, Update, and Delete operations will include only headers and status code, omitting content.

True

Boolean

Multiple Write Regions Enabled

Allows writes to any region for geo-replicated database accounts. When enabled, the SDK routes writes to available writable regions, following the order in the Preferred Regions parameter.

True

Boolean

Preferred Regions (DB)

Specifies preferred regions for geo-replicated database accounts, as a comma-separated list (for example, "East US").

N/A

String

Read Requests Fallback Enabled

Allows reads from multiple regions for accounts with multi-region configurations.

True

Boolean

Documentation tab

Parameter
Description
Default value
Data type

Documentation

Section for documenting any necessary information about the connector configuration and business rules.

N/A

String

Operations

Create Item

Creates an item on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Container Partition Key Path

  • Item Partition Key

  • Body

Example

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Container Partition Key Path: partition

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "Create All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 159,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Output

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29008962-0000-0b00-0000-672908970000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.718, x-ms-session-token=0:-1#484, lsn=484, x-ms-request-charge=11.62, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=2, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=334;documentsCount=301;collectionSize=413;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=483, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=483, x-ms-activity-id=cbfbb673-9ad4-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=483, x-ms-cosmos-llsn=484, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29008962-0000-0b00-0000-672908970000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "201"
  }
}

Delete Item

Deletes an item on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

Example

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

Output

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": null,
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.862, x-ms-session-token=0:-1#493, lsn=493, x-ms-request-charge=11.62, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=21, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=365;documentsCount=300;collectionSize=444;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=492, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=492, x-ms-activity-id=a9f74180-9ae0-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=492, x-ms-cosmos-llsn=493, x-ms-documentdb-partitionkeyrangeid=0, x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "204"
  }
}

Query Items

Queries items on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Query

Example

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Query: "SELECT * FROM c"

Output

{
  "success": true,
  "body": {
    "result": [
      {
        "id": "4E4B38CB-0D82-43E5-89AF-20270CD28A04",
        "categoryId": "75BF1ACB-168D-469C-9AA3-1FD26BB4EA4C",
        "categoryName": "Bikes, Touring Bikes",
        "sku": "BK-T44U-60",
        "name": "Touring-2000 Blue, 60",
        "description": "The product called \"Touring-2000 Blue, 60\"",
        "price": 1214.85,
        "tags": [
          {
            "id": "89FB612A-F9AA-4196-B5F5-B9FA16D558DC",
            "name": "Tag-175"
          },
          {
            "id": "A30014DE-B012-4049-B456-4630527AF47F",
            "name": "Tag-9"
          },
          {
            "id": "B18FB652-C4B6-4A40-BA22-1E687C1A58CE",
            "name": "Tag-161"
          },
          {
            "id": "C6AB3E24-BA48-40F0-A260-CB04EB03D5B0",
            "name": "Tag-73"
          }
        ],
        "_rid": "T0kSAIhFqysBAAAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysBAAAAAAAAAA==/",
        "_etag": "\"010007a9-0000-0b00-0000-6717edb20000\"",
        "_attachments": "attachments/",
        "_ts": 1729621426
      },
      {
        "id": "58978B2E-D4C6-4D69-A840-D935688F9C2D",
        "categoryId": "3E4CEACD-D007-46EB-82D7-31F6141752B2",
        "categoryName": "Components, Road Frames",
        "sku": "FR-R92R-56",
        "name": "HL Road Frame - Red, 56",
        "description": "The product called \"HL Road Frame - Red, 56\"",
        "price": 1431.5,
        "tags": [
          {
            "id": "3A3A99B6-E3BF-46D0-BAD9-F5F4DBB720F4",
            "name": "Tag-70"
          },
          {
            "id": "66D8EA21-E1F0-471C-A17F-02F3B149D6E6",
            "name": "Tag-83"
          },
          {
            "id": "69212884-78CF-48C9-A5C6-B62E76725533",
            "name": "Tag-104"
          },
          {
            "id": "A9834752-41CA-47F5-8A5A-D9A878DF0ACB",
            "name": "Tag-198"
          },
          {
            "id": "D5887E7C-B916-4AF4-BAF8-7B996ADA8C83",
            "name": "Tag-52"
          }
        ],
        "_rid": "T0kSAIhFqysCAAAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysCAAAAAAAAAA==/",
        "_etag": "\"010008a9-0000-0b00-0000-6717edb20000\"",
        "_attachments": "attachments/",
        "_ts": 1729621426
      }
           {
        "id": "E681778F-8359-468B-98F9-4D325D6C377F",
        "categoryId": "C3C57C35-1D80-4EC5-AB12-46C57A017AFB",
        "categoryName": "Clothing, Jerseys",
        "sku": "SJ-0194-S",
        "name": "Short-Sleeve Classic Jersey, S",
        "description": "The product called \"Short-Sleeve Classic Jersey, S\"",
        "price": 53.99,
        "tags": [
          
        ],
        "_rid": "T0kSAIhFqysOAQAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysOAQAAAAAAAA==/",
        "_etag": "\"010015aa-0000-0b00-0000-6717edb40000\"",
        "_attachments": "attachments/",
        "_ts": 1729621428
      }

Read Item

Reads an item on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

Example

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

Output

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29008962-0000-0b00-0000-672908970000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:07:54.126 GMT, x-ms-request-duration-ms=0.228, x-ms-session-token=0:-1#485, lsn=485, x-ms-request-charge=1.0, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=9, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=363;documentsCount=301;collectionSize=442;, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-activity-id=9db50cb4-9ade-11ef-8442-9588d1808a88, x-ms-cosmos-item-llsn=484, x-ms-xp-role=1, x-ms-global-Committed-lsn=485, x-ms-item-lsn=484, x-ms-cosmos-llsn=485, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29008962-0000-0b00-0000-672908970000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  },
  "body": {
    "result": {
      "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
      "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
      "categoryName": "Accessories, Bike Stands",
      "sku": "ST-1401",
      "name": "Create All-Purpose Bike Stand",
      "description": "XXXX The product called \"All-Purpose Bike Stand\"",
      "price": 159,
      "tags": [
        {
          "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
          "name": "Tag-101"
        },
        {
          "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
          "name": "Tag-72"
        },
        {
          "id": "5A94DABD-FD34-48F7-9626-50872E214275",
          "name": "Tag-181"
        },
        {
          "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
          "name": "Tag-170"
        },
        {
          "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
          "name": "Tag-8"
        }
      ],
      "_rid": "T0kSAIhFqytpAQAAAAAAAA==",
      "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqytpAQAAAAAAAA==/",
      "_etag": "\"29008962-0000-0b00-0000-672908970000\"",
      "_attachments": "attachments/",
      "_ts": 1730742423
    }
  }
}

Replace Item

Replaces an item on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

  • Body

Example:

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "XXXX All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 15,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Output

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"290028b5-0000-0b00-0000-67291b9f0000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.928, x-ms-session-token=0:-1#490, lsn=490, x-ms-request-charge=11.05, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=15, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=365;documentsCount=299;collectionSize=444;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=489, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=489, x-ms-activity-id=23624866-9ae0-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=489, x-ms-cosmos-llsn=490, x-ms-documentdb-partitionkeyrangeid=0, etag=\"290028b5-0000-0b00-0000-67291b9f0000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  }
}

Upsert Item

Creates or updates an item on CosmosDB. Provide:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

  • Body

Example

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "XXXX All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 160,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Output

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29009dae-0000-0b00-0000-67291a490000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.223, x-ms-session-token=0:-1#487, lsn=487, x-ms-request-charge=11.05, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=10, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=363;documentsCount=299;collectionSize=442;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=486, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=486, x-ms-activity-id=579d849b-9adf-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=486, x-ms-cosmos-llsn=487, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29009dae-0000-0b00-0000-67291a490000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  }
}

Last updated