| Crates.io | cognite-sdk |
| lib.rs | cognite-sdk |
| version | 0.6.1 |
| created_at | 2026-01-05 11:06:12.712817+00 |
| updated_at | 2026-01-09 15:39:49.916831+00 |
| description | SDK for the Cognite Data Fusion API |
| homepage | https://github.com/cognitedata/cognite-sdk-rust |
| repository | https://github.com/cognitedata/cognite-sdk-rust |
| max_upload_size | |
| id | 2023642 |
| size | 791,398 |
Rust SDK to ensure excellent user experience for developers and data scientists working with the Cognite Data Fusion.
Install rust. See instructions here.
Set environment variables:
export COGNITE_BASE_URL="https://api.cognitedata.com"
export COGNITE_CLIENT_ID=<your client id>
export COGNITE_CLIENT_SECRET=<your client secret>
export COGNITE_TOKEN_URL=<your token url>
export COGNITE_SCOPES=<space separated list of scopes>
export COGNITE_PROJECT=<your project name>
Cargo.toml:
[dependencies]
cognite-sdk = { version = "0.6.0" } # See crates.io for latest version.
tokio = { version = "1.23", features = ["macros", "rt-multi-thread"] }
use cognite::prelude::*;
use cognite::{Asset, AssetFilter, AssetSearch, CogniteClient};
#[tokio::main]
fn main() {
// Create a client from environment variables
let cognite_client = CogniteClient::new("TestApp", None).unwrap();
// List all assets
let mut filter: AssetFilter = AssetFilter::new();
filter.name = Some("Aker".to_string());
let assets = cognite_client
.assets
.filter(FilterAssetsRequest {
filter,
..Default::default()
})
.await
.unwrap();
// Retrieve asset
match cognite_client
.assets
.retrieve(&vec![Identity::from(6687602007296940)], false, None)
.await
.unwrap();
}
Using the builder pattern to set OIDC credentials:
use cognite::prelude::*;
#[tokio::main]
fn main() {
let builder = CogniteClient::builder();
builder
.set_oidc_credentials(AuthenticatorConfig {
...
})
.set_project("my_project")
.set_app_name("TestApp")
.set_base_url("https://api.cognitedata.com");
let cognite_client = builder.build().unwrap();
}
cargo run --example client
See Contributing for details.