Sample code for 30+ languages & platforms
Rust

Woo Commerce Authenticate with Query Params

See more WooCommerce Examples

Demonstrates how to authenticate with Woo Commerce over HTTPS using query params instead of HTTP Basic Authentication.

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();

// To authentication over HTTPS using query params, put the query params in the URL.
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://example.com/wp-json/wc/v3/products?consumer_key=ck_52bf39999999999999999999999999999996da4d&consumer_secret=cs_6e8bb99999999999999999999999999999997054", &sb_response_body).is_err() {
    println!("{}", http.last_error_text());
    return;
}

println!("Response Body:");
println!("{}", sb_response_body.get_as_string().unwrap_or_default());

let resp_status_code = http.last_status();
println!("Response Status Code = {}", resp_status_code);
if resp_status_code >= 400 {
    println!("Response Header:");
    println!("{}", http.last_header());
    println!("Failed.");
    return;
}