Rust Requires Chilkat v11.0.0+
Rust
Datev - Upload File (Transfer a file to DATEV data center)
See more Datev Examples
Demonstrates how to transfer a file to the DATEV data center.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 POST \
// --url "https://accounting-extf-files.api.datev.de/platform-sandbox/v3/clients/REPLACE_CLIENT-ID/extf-files/import" \
// --header "Authorization: Bearer REPLACE_BEARER_TOKEN" \
// --header "X-Datev-Client-ID: clientId" \
// --header "accept: application/json;charset=utf-8" \
// --header "content-type: application/octet-stream" \
// --header "Filename: EXTF_BS_20200101_1.csv" \
// --header "Reference-Id: Buchungsstapel_Verkäufe_2020_01_Nr_001" \
// --header "Client-Application-Version: 2.0c" \
// --data-binary "@REPLACE_BODY"
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
let bd_request_body = chilkat::BinData::new();
if bd_request_body.load_file("c:/temp/EXTF_BS_20200101_1.csv").is_err() {
println!("Failed to load the csv file.");
return;
}
http.set_request_header("accept", "application/json;charset=utf-8");
http.set_request_header("X-Datev-Client-ID", "clientId");
http.set_request_header("Client-Application-Version", "2.0c");
http.set_request_header("Filename", "EXTF_BS_20200101_1.csv");
http.set_request_header("Reference-Id", "Buchungsstapel_Verkäufe_2020_01_Nr_001");
// Adds the "Authorization: Bearer REPLACE_BEARER_TOKEN" header.
http.set_auth_token("REPLACE_BEARER_TOKEN");
let resp = chilkat::HttpResponse::new();
let url = "https://accounting-extf-files.api.datev.de/platform-sandbox/v3/clients/DATEV_USER_ID/extf-files/import".to_string();
if http.http_bd("POST", &url, &bd_request_body, "application/octet-stream", &resp).is_err() {
println!("{}", http.last_error_text());
return;
}
println!("{}", resp.status_code());
println!("{}", resp.body_str());