Features

The DNSimple Rust API Client Goes Async

Simone Carletti's profile picture Simone Carletti on

A few years after introducing our Rust REST API client, we're happy to announce that one of the most requested features has finally landed in dnsimple-rust: full async support. The new major release migrates the entire client to an async-first design.

If you've been waiting for this, thanks for your patience, and thanks for the issues, comments, and emails to support that kept the conversation alive.

What's new

All API methods are now async and return futures. Internally, the client moved from ureq to reqwest, which gives us first-class async I/O, HTTP/2, and a modern TLS stack via rustls.

In practice, this means dnsimple-rust now plays nicely with the rest of the Rust async ecosystem. You can drop it into a Tokio-based service, an Axum or Actix application, or a background worker, without blocking the runtime.

Using the new client

Add the crate and a Tokio runtime to your Cargo.toml:

[dependencies]
dnsimple = "6"
tokio = { version = "1", features = ["rt", "macros"] }

Then call any endpoint with .await:

use dnsimple::dnsimple::new_client;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let client = new_client(false, String::from("AUTH_TOKEN")).unwrap();

    let identity = client.identity().whoami().await.unwrap().data.unwrap();
    let account_id = identity.account.unwrap().id;

    let domains = client
        .domains()
        .list_domains(account_id, None)
        .await
        .unwrap()
        .data
        .unwrap();

    println!("Found {} domains", domains.len());
}

That's the whole upgrade story. Existing call sites need an .await, and the surrounding function needs to be async. The shape of the API, the resource services, and the response types are unchanged.

Why this matters

A blocking HTTP client was fine for scripts and small CLIs, but it's a poor fit for the kind of services most Rust shops are building today. With async, you can:

  • Issue many DNSimple API calls concurrently without spinning up a thread per request.
  • Integrate the client into web servers, background workers, or stream processors without workarounds like tokio::task::spawn_blocking.
  • Compose DNSimple calls with other async work (databases, queues, other APIs) using the usual join!, select!, and try_join! combinators.

It's a small change at the source level, and a meaningful upgrade in how the client behaves under load.

More clients, same API

dnsimple-rust is one of nine official API clients we maintain. If Rust isn't your stack, we have eight more to choose from: Ruby, Go, Elixir, Node.js, Java, C#, PHP, and Python. You can find them all listed in our developer documentation, along with the full API reference.

Wrapping up

Have a look at the CHANGELOG for the full set of changes, and the crate documentation for the new async signatures. If you run into anything, open an issue or get in touch, we're happy to help.

If you're not using DNSimple yet, give us a try free for 30 days, and automate your domains and DNS with our API and official client libraries.

Share on Twitter and Facebook

Simone Carletti's profile picture

Simone Carletti

Italian software developer, a PADI scuba instructor and a former professional sommelier. I make awesome code and troll Anthony for fun and profit.

We think domain management should be easy.
That's why we continue building DNSimple.

Try us free for 30 days
4.5 stars

4.5 out of 5 stars.

Based on Trustpilot.com and G2.com reviews.