Sift’s gRPC API is designed for high-frequency telemetry ingestion and real-time analysis, offering optimized performance and scalability. It uses Protocol Buffers for defining services and messages, enabling efficient, high-throughput communication. You can interact with Sift’s gRPC API in multiple ways:
Directly using standard tools like grpcurl or by writing your own gRPC clients.
Using Sift’s pre-built client libraries, available for select programming languages to simplify setup.
Sift’s client libraries internally use the gRPC API. If a client library is not available for your preferred language, you can manually generate client code from Sift’s Protocol Buffers or use command-line tools to interact with the gRPC API.
Official client libraries to connect with Sift’s gRPC API
Sift provides pre-built client libraries for select programming languages, designed to simplify and accelerate integration with Sift’s gRPC API. Sift’s official client libraries internally use the gRPC API. These libraries offer helpful utilities and reduce the boilerplate required to get started. All libraries are open source and maintained in the Sift GitHub repository. Supported languages:
The required format for official gRPC API URLs depends on your client library. Some libraries require you to omit the URL scheme and port number, while others expect them to be included. Refer to the documentation of your chosen client library to confirm the expected URL format.
Language
Requires https:// prefix
Requires port number
Python
No
No
Rust
Yes
No
Go
No
Yes
The gRPC API uses port 443 by default in all environments.
In your Python environment directory, run the following command after replacing the placeholders ($SIFT_API_KEY and $SIFT_GRPC_BASE_URL) with your actual values:
To quickly connect with Sift’s Rust client, consider the following steps:
Create a Rust project.
Copy
Ask AI
cargo new my_sift_project
In your Rust project, add the sift_rs crate.
Copy
Ask AI
cd my_sift_projectcargo add sift_rs
In your Rust project, add the tokio runtime.
Copy
Ask AI
cargo add tokio --features full
Copy and paste the following into your my_sift_project/src/main.rs:
Copy
Ask AI
use sift_rs::{ Credentials, SiftChannelBuilder, ping::v1::{PingRequest, ping_service_client::PingServiceClient},};use std::env;#[tokio::main]async fn main() { let credentials = Credentials::Config { apikey: env::var("SIFT_API_KEY").unwrap(), uri: env::var("SIFT_GRPC_BASE_URL").unwrap(), }; let conn = SiftChannelBuilder::new(credentials).build().unwrap(); let mut ping_service = PingServiceClient::new(conn); let ping_response = ping_service.ping(PingRequest::default()).await.unwrap(); println!("{}", ping_response.into_inner().response);}
In your Rust project directory, run the following command after replacing the placeholders ($SIFT_API_KEY and $SIFT_GRPC_BASE_URL) with your actual values:
Copy
Ask AI
SIFT_GRPC_BASE_URL=$SIFT_GRPC_BASE_URL:$PORT_NUM SIFT_API_KEY=$SIFT_API_KEY cargo run
$SIFT_API_KEY: To learn how to create an API key, see Create an API key.
$SIFT_GRPC_BASE_URL:
The Rust client requires you to add the URL scheme while adding the port number is optional.
In your Go module, run the following command after replacing the placeholders ($SIFT_API_KEY, $SIFT_GRPC_BASE_URL, and $PORT_NUM) with your actual values:
Copy
Ask AI
SIFT_GRPC_BASE_URL=$SIFT_GRPC_BASE_URL:$PORT_NUM SIFT_API_KEY=$SIFT_API_KEY go run .
$SIFT_GRPC_BASE_URL: The base URL for Sift gRPC requests.
The Go client expects the base URL without the URL scheme (for example, use api.siftstack.com, not https://api.siftstack.com).