Rust
Rust
Lightspeed - Delete a Product
See more Lightspeed Examples
Remove an existing product based on the unique identifierChilkat Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = chilkat::Http::new();
// Implements the following CURL command:
// curl -X DELETE https://api.webshopapp.com/en/products/PRODUCT_ID.json \
// -u API_KEY:API_SECRET
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
http.set_login("API_KEY");
http.set_password("API_SECRET");
// Use the correct cluster for your shop. Here are the choices:
// eu1 https://api.webshopapp.com/en/
// us1 https://api.shoplightspeed.com/en/
let resp = chilkat::HttpResponse::new();
if http.http_no_body("DELETE", "https://api.webshopapp.com/en/products/PRODUCT_ID.json", &resp).is_err() {
println!("{}", http.last_error_text());
return;
}
let resp_status_code = resp.status_code();
println!("Response Status Code = {}", resp_status_code);
if resp_status_code != 204 {
println!("Response Header:");
println!("{}", resp.header());
println!("Response Body:");
println!("{}", resp.body_str());
println!("Failed.");
return;
}
println!("Success.");