Azure Cosmos DB SDK Reference
This section provides detailed reference documentation for the various Azure Cosmos DB Software Development Kits (SDKs). Choose your preferred language below to access specific API documentation, code examples, and best practices.
Available SDKs
.NET SDK
Latest Version: 3.x
Key Classes:
CosmosClient
Container
ItemResponse
QueryDefinition
Java SDK
Latest Version: 4.x
Key Classes:
CosmosClient
CosmosDatabase
CosmosContainer
CosmosItemRequestOptions
Node.js SDK
Latest Version: 3.x
Key Classes:
CosmosClient
Database
Container
SqlQuerySpec
Python SDK
Latest Version: 4.x
Key Classes:
CosmosClient
DatabaseProxy
ContainerProxy
PartitionKey
Go SDK
Latest Version: 1.x
Key Packages:
cosmos.Client
cosmos.Database
cosmos.Container
cosmos.QueryOptions
Common SDK Operations
Below are common operations you'll perform using the Azure Cosmos DB SDKs:
- Initializing the Cosmos DB client
- Creating, reading, updating, and deleting databases and containers
- Performing CRUD operations on items
- Executing SQL queries and stored procedures
- Managing partitions and throughput
- Handling conflict resolution
Getting Started with the SDKs
To get started, download the SDK for your preferred language from its respective package manager (e.g., NuGet for .NET, Maven for Java, npm for Node.js, pip for Python). Refer to the SDK-specific documentation for detailed installation and usage instructions.
For comprehensive examples and tutorials, visit the Code Samples section.
Best Practices
Ensure you follow best practices for optimal performance and cost-effectiveness:
- Request optimal throughput for your containers.
- Use appropriate indexing policies for your query patterns.
- Leverage client-side query caching where applicable.
- Implement retry logic for transient network errors.
- Reuse
CosmosClient
instances across your application.
If you encounter issues, consult the Troubleshooting Guide or the specific SDK's GitHub repository for support.