tokio, but any runtime works, since the client is built on reqwest.
Installing
Your first request
You’ll need an API key from Settings > API keys (see API keys). Then:Parameters and payloads
Every endpoint is an async function that takes a&Configuration and a params struct, even endpoints with no parameters today. That’s deliberate: when the API adds a parameter, it becomes a new field on a struct you already use, rather than a change to the function’s signature.
new() takes the endpoint’s required parameters. Optional ones are chainable set_* methods, which take the value directly rather than Some(value):
#[non_exhaustive], so you can’t build one with a struct literal. Use new() and the set_* methods instead. This is what lets us add fields to the API without breaking your build.
Pagination
List endpoints are cursor-paginated. Read the next cursor frompagination_meta.after and pass it back:
Filtering
List endpoints filter on a map of operator to values, sent ascreated_at[gte]=2024-05-01. The operators each field accepts are in its docs, and are commonly one_of, not_in, gte, and lte.
Errors
Every endpoint returnsResult<T, Error<SomethingError>>, where the inner enum has a variant per documented status code. Documenting another status code is a backwards-compatible change for us, so these enums need a wildcard arm:
Unknown(String) variant for values your version doesn’t know about, and a wildcard arm is required.
Configuration
Every field onConfiguration is public, so change what you need:
429 response body tells you when to try again. The README shows how to read it.
TLS uses rustls by default. To use OpenSSL instead, turn off default features and enable native-tls.
Deprecated endpoints
Endpoints we’ve deprecated stay available and carry#[deprecated], so rustc warns at the call site. Don’t go by the version in the name: some v2 endpoints are deprecated too.
Versioning
The SDK is kept up to date with the API automatically. Additions to the API are minor versions. A change that would break your code, like a removed field, is released as a new major version, and its release notes list what changed.Resources
crates.io
The
incident-io crate and its versions.docs.rs
Every type and function, with their docs.
GitHub
Source, README, and issues for the Rust SDK.
All SDKs
Clients for Go, TypeScript, Python, Ruby, PHP, and .NET.