Rust
Rust
MYOB: Delete a Category
See more MYOB Examples
Sends a DELETE to delete a category.Chilkat 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 --request DELETE "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/{{category_id}}" \
// --header "Authorization: Bearer ACCESS_TOKEN" \
// --header "x-myobapi-key: This is your API Key" \
// --header "x-myobapi-version: v2" \
// --header "Accept-Encoding: gzip,deflate"
http.set_request_header("Authorization", "Bearer ACCESS_TOKEN");
http.set_request_header("x-myobapi-key", "This is your API Key");
http.set_request_header("Accept-Encoding", "gzip,deflate");
http.set_request_header("x-myobapi-version", "v2");
let resp = chilkat::HttpResponse::new();
if http.http_no_body("DELETE", "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/{{category_id}}", &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 != 200 {
println!("Response Header:");
println!("{}", resp.header());
println!("Response Body:");
println!("{}", resp.body_str());
println!("Failed.");
return;
}
println!("Success.");