SDKs overview
The Salesforce platform offers a range of Software Development Kits (SDKs) and client libraries designed to simplify programmatic interaction with its various APIs. These SDKs handle complexities such as authentication, request formatting, and response parsing, allowing developers to focus on application logic rather than low-level API mechanics. Salesforce provides official SDKs for key programming languages, alongside a robust ecosystem of community-developed tools that extend its capabilities. Developers leverage these resources to build custom applications, integrate Salesforce with external systems, and automate business processes with the Salesforce API API references.
The SDKs abstract the underlying API protocols, which include the REST API for general data access, the SOAP API for robust integrations, the Bulk API for large data operations, and the Streaming API for real-time event notifications. Each SDK is tailored to the conventions and best practices of its respective programming language, providing an idiomatic development experience Salesforce API documentation.
Official SDKs by language
Salesforce maintains official SDKs for several popular programming languages, ensuring compatibility and stable integration with the platform. These SDKs are actively supported and updated by Salesforce, reflecting the latest API versions and security standards. Developers can find detailed documentation and examples for each SDK on the official Salesforce Developer website Salesforce developer documentation.
The following table outlines the key official SDKs available:
| Language | Package/Library Name | Primary Installation Command | Maturity/Status |
|---|---|---|---|
| Apex | Built-in to Salesforce Platform | N/A (Developed directly on platform) | Core language for Salesforce platform development |
| Java | Force.com Java SDK | Maven: com.force.api:force-wsc or Gradle: com.force.api:force-wsc |
Stable, actively maintained |
| Node.js | JSforce (Community-driven, Salesforce endorsed) | npm install jsforce |
Stable, widely used, actively maintained |
| Python | simple-salesforce (Community-driven, widely adopted) | pip install simple-salesforce |
Stable, widely used, actively maintained |
| .NET | Salesforce .NET SDK (deprecated), Salesforce .NET Standard Library (community) | NuGet: Salesforce.Common or NuGet: Salesforce.SDK |
Community libraries are active, official SDK deprecated |
Installation
Installation procedures vary based on the programming language and package manager used. Detailed instructions for each SDK are available in their respective documentation. Below are general installation commands for the most commonly used SDKs:
Java
The Force.com Java SDK can be integrated into Maven or Gradle projects. For Maven, add the following dependency to your pom.xml file:
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-wsc</artifactId>
<version>[latest_version]</version>
</dependency>
Replace [latest_version] with the most current stable version Force.com Java SDK installation.
Node.js (JSforce)
JSforce is installed via npm, the Node.js package manager:
npm install jsforce
This command adds JSforce to your project's dependencies JSforce GitHub repository.
Python (simple-salesforce)
simple-salesforce is installed using pip, Python's package installer:
pip install simple-salesforce
This command downloads and installs the package and its dependencies simple-salesforce PyPI page.
.NET (Salesforce.Common)
For .NET projects, the community-maintained Salesforce.Common library can be installed via NuGet:
Install-Package Salesforce.Common
This command installs the package into your .NET project Salesforce.Common NuGet package.
Quickstart example
The following example demonstrates how to connect to Salesforce and query records using the Python simple-salesforce library. This snippet performs a SOQL query to retrieve account names.
from simple_salesforce import Salesforce
# Replace with your Salesforce credentials or obtain them securely
username = 'YOUR_SALESFORCE_USERNAME'
password = 'YOUR_SALESFORCE_PASSWORD'
security_token = 'YOUR_SALESFORCE_SECURITY_TOKEN'
# Instantiate Salesforce connection
# For sandbox, add domain='test' parameter
sf = Salesforce(username=username, password=password, security_token=security_token)
try:
# Execute a SOQL query to get the Name of all Account records
query_result = sf.query("SELECT Id, Name FROM Account LIMIT 5")
print("Successfully connected to Salesforce and queried accounts.")
print(f"Total records retrieved: {query_result['totalSize']}")
for record in query_result['records']:
print(f"Account ID: {record['Id']}, Name: {record['Name']}")
except Exception as e:
print(f"An error occurred: {e}")
# Example of creating a new Account (uncomment to run)
# new_account = sf.Account.create({
# 'Name': 'New Test Account from Python SDK',
# 'Description': 'Created via simple-salesforce SDK example'
# })
# print(f"New Account created with ID: {new_account['id']}")
This example demonstrates basic authentication and a SOQL query. For production applications, it is crucial to manage credentials securely, ideally using environment variables or a configuration management system, rather than hardcoding them Salesforce authentication overview. Additionally, error handling and pagination for large query results should be implemented.
Community libraries
Beyond the officially supported SDKs, the Salesforce developer community has contributed numerous libraries and tools that enhance integration and development workflows. These community-driven projects often fill gaps, provide specialized functionality, or offer alternative approaches to interacting with the Salesforce API.
- JSforce (Node.js): While widely adopted and often recommended by Salesforce, JSforce is an open-source library maintained by the community. It provides comprehensive support for various Salesforce APIs, including REST, SOAP, Metadata, and Tooling APIs JSforce documentation.
- simple-salesforce (Python): This popular Python library offers a simplified interface for the Salesforce REST API. It handles authentication, sObject CRUD operations, and SOQL/SOSL queries, making it a go-to choice for Python developers simple-salesforce GitHub.
- Salesforce .NET Standard Library: For .NET developers, projects like
Salesforce.CommonandSalesforce.SDKprovide wrappers for the Salesforce REST API, offering a .NET-idiomatic way to interact with the platform. These are community-maintained alternatives since the official .NET SDK was deprecated Salesforce.Common NuGet. - Salesforce CLI: While not an SDK in the traditional sense, the Salesforce Command Line Interface (CLI) is an essential tool for developers. It enables command-line interaction with Salesforce orgs, facilitating tasks like scratch org creation, metadata deployment, data import/export, and executing Apex Salesforce CLI Reference. The CLI can also be extended with plugins, many of which are community-contributed.
- MuleSoft Connectors: While MuleSoft is a Salesforce company, its Anypoint Platform offers connectors for Salesforce that enable low-code integration with other systems. These connectors abstract the complexities of the Salesforce APIs, allowing for rapid integration development MuleSoft Salesforce Connector. While not an SDK for direct code development, it represents a significant integration option.
When selecting a community library, developers should consider factors such as active maintenance, community support, the breadth of API coverage, and license compatibility. Checking the project's GitHub repository for recent commits, open issues, and pull requests can provide insight into its ongoing viability and reliability, a practice recommended for any open-source dependency AWS Security Best Practices for Open Source Software.