Sample code for 30+ languages & platforms
Rust Requires Chilkat v11.0.0+

BrickLink OAuth1 using Chilkat HTTP

See more BrickLink Examples

Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let http = chilkat::Http::new();

http.set_o_auth1(true);
http.set_o_auth_consumer_key("Your Consumer Key");
http.set_o_auth_consumer_secret("Your Consumer Secret");
http.set_o_auth_token("Your OAuth1 Token");
http.set_o_auth_token_secret("Your Token Secret");
http.set_o_auth_sig_method("HMAC-SHA1");

let resp = chilkat::HttpResponse::new();
if http.http_no_body("GET", "https://api.bricklink.com/api/store/v1/orders?direction=in", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

println!("Response status code = {}", resp.status_code());

let json = chilkat::JsonObject::new();
let _ = resp.get_body_json(&json);

json.set_emit_compact(false);
println!("{}", json.emit().unwrap_or_default());