Rust
Rust
Magento Request with OAuth1.0a Authentication
See more Magento Examples
Demonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)Chilkat Rust Downloads
// This example requires 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_verifier("");
http.set_o_auth_consumer_key("MAGENTO_CONSUMER_KEY");
http.set_o_auth_consumer_secret("MAGENTO_CONSUMER_SECRET");
http.set_o_auth_token("MAGENTO__TOKEN");
http.set_o_auth_token_secret("MAGENTO_TOKEN_SECRET");
http.set_accept("application/json");
let url = "http://www.inart.com/api/rest/products/store/2?limit=20&page=1".to_string();
let Ok(json_str) = http.quick_get_str(&url) else {
println!("{}", http.last_error_text());
return;
};
println!("Response status code = {}", http.last_status());
let json = chilkat::JsonObject::new();
let _ = json.load(&json_str);
json.set_emit_compact(false);
println!("{}", json.emit().unwrap_or_default());
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON