Rust
Rust
Aruba Fatturazione Elettronica getByIdSdi
See more Aruba Fatturazione Examples
This method returns the complete status detail of an electronic invoice. Search for a single invoice by SdI identifier.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 -X GET https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true \
// -H "Accept: application/json" \
// -H "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// Adds the "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" header.
http.set_auth_token("NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=");
http.set_request_header("Accept", "application/json");
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true", &sb_response_body).is_err() {
println!("{}", http.last_error_text());
return;
}
let resp_status_code = http.last_status();
println!("response status code = {}", resp_status_code);
let json = chilkat::JsonObject::new();
let _ = json.load_sb(&sb_response_body);
json.set_emit_compact(true);
println!("Response JSON:");
println!("{}", json.emit().unwrap_or_default());
if resp_status_code != 200 {
println!("Failed.");
return;
}
// Sample response:
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// {
// "errorCode" : "0000",
// "errorDescription" : null,
// "id" : "1",
// "sender" : {
// "description" : "Aruba SPA",
// "countryCode" : "IT",
// "vatCode" : "22222222",
// "fiscalCode" : "11111111111"
// },
// "receiver" : {
// "description" : "Aruba SPA",
// "countryCode" : "IT",
// "vatCode" : "4444444",
// "fiscalCode" : "333333333"
// },
// "invoiceType" : "FPR12",
// "docType" : "in",
// "file" : "dGVzdA==",
// "filename" : "IT01879020517_jtlk0.xml.p7m",
// "invoices" : [ {
// "invoiceDate" : "2021-08-24T12:35:45.363+02:00",
// "number" : "2021/0001",
// "status" : "Inviata",
// "statusDescription" : ""
// } ],
// "username" : "Utente",
// "lastUpdate" : "2021-08-24T10:35:45.363+0000",
// "creationDate" : "2021-08-24T10:35:45.363+0000",
// "idSdi" : "11110",
// "pdfFile" : "ZEdWemRGQmtaZz09",
// "pddAvailable" : true
// }
//
let error_code = json.string_of("errorCode").unwrap_or_default();
let error_description = json.string_of("errorDescription").unwrap_or_default();
let id = json.string_of("id").unwrap_or_default();
let sender_description = json.string_of("sender.description").unwrap_or_default();
let sender_country_code = json.string_of("sender.countryCode").unwrap_or_default();
let sender_vat_code = json.string_of("sender.vatCode").unwrap_or_default();
let sender_fiscal_code = json.string_of("sender.fiscalCode").unwrap_or_default();
let receiver_description = json.string_of("receiver.description").unwrap_or_default();
let receiver_country_code = json.string_of("receiver.countryCode").unwrap_or_default();
let receiver_vat_code = json.string_of("receiver.vatCode").unwrap_or_default();
let receiver_fiscal_code = json.string_of("receiver.fiscalCode").unwrap_or_default();
let invoice_type = json.string_of("invoiceType").unwrap_or_default();
let doc_type = json.string_of("docType").unwrap_or_default();
let file = json.string_of("file").unwrap_or_default();
let filename = json.string_of("filename").unwrap_or_default();
let username = json.string_of("username").unwrap_or_default();
let last_update = json.string_of("lastUpdate").unwrap_or_default();
let creation_date = json.string_of("creationDate").unwrap_or_default();
let id_sdi = json.string_of("idSdi").unwrap_or_default();
let pdf_file = json.string_of("pdfFile").unwrap_or_default();
let pdd_available = json.bool_of("pddAvailable");
let mut i = 0;
let count_i = json.size_of_array("invoices");
while i < count_i {
json.set_i(i);
let _ = json.string_of("invoices[i].invoiceDate").unwrap_or_default();
let _ = json.string_of("invoices[i].number").unwrap_or_default();
let _ = json.string_of("invoices[i].status").unwrap_or_default();
let _ = json.string_of("invoices[i].statusDescription").unwrap_or_default();
i = i + 1;
}