salesforce_core 0.13.4

Unofficial Rust SDK for Salesforce APIs
docs.rs failed to build salesforce_core-0.13.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: salesforce_core-0.13.6

salesforce_core

Crates.io Docs.rs

Unofficial Rust SDK for the Salesforce Core (Sales Cloud, Service Cloud, Platform, etc.) APIs: REST, Bulk 2.0, Pub/Sub (gRPC), and Tooling.

Part of the salesforce-rs project. Sibling crates for other Salesforce products (Marketing Cloud, Data Cloud, etc.) live in the same repo.

Installation

[dependencies]
salesforce_core = "0.13"

Quick start

Authenticate with the client credentials OAuth2 flow, then issue REST calls:

use salesforce_core::client;
use salesforce_core::restapi;
use serde_json::json;
use std::path::PathBuf;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let auth = client::Builder::new()
        .credentials_path(PathBuf::from(std::env::var("SFDC_CREDENTIALS")?))
        .build()?
        .connect()
        .await?;

    let rest = restapi::ClientBuilder::new(auth).build()?;

    let resp = rest.create("Account", json!({ "Name": "Acme" })).await?;
    let record = rest.get("Account", &resp.id, None).await?;
    println!("{record}");
    rest.delete("Account", &resp.id).await?;

    Ok(())
}

The credentials JSON file:

{
  "client_id": "...",
  "client_secret": "...",
  "instance_url": "https://your-instance.my.salesforce.com",
  "tenant_id": "..."
}

What's included

  • OAuth2 — client credentials flow, username-password flow, automatic token refresh
  • REST API — SObject CRUD, describe, basic info, SOSL search
  • Composite REST API — batch create/update/delete/retrieve, upsert, record trees
  • Bulk API 2.0 — query and ingest jobs for large datasets
  • Pub/Sub API (gRPC) — platform events, Change Data Capture, managed subscriptions
  • Tooling API — managed event subscription metadata

For the full API reference and examples, see the project README and the examples directory.

License

MPL-2.0