Rust
Rust
Aruba Fatturazione Elettronica userinfo
See more Aruba Fatturazione Examples
This method lets you retrieve user information relating to the authentication token.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://auth.fatturazioneelettronica.aruba.it/auth/userInfo \
// -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=");
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://auth.fatturazioneelettronica.aruba.it/auth/userInfo", &sb_response_body).is_err() {
println!("{}", http.last_error_text());
return;
}
let j_resp = chilkat::JsonObject::new();
let _ = j_resp.load_sb(&sb_response_body);
j_resp.set_emit_compact(false);
println!("Response Body:");
println!("{}", j_resp.emit().unwrap_or_default());
let resp_status_code = http.last_status();
println!("Response Status Code = {}", resp_status_code);
if resp_status_code >= 400 {
println!("Response Header:");
println!("{}", http.last_header());
println!("Failed.");
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "username": "ARUBA0000",
// "pec": "pec@pec.it",
// "userDescription": "Aruba PEC S.p.A.",
// "countryCode": "IT",
// "vatCode": "01879020517",
// "fiscalCode": "01879020517",
// "accountStatus": {
// "expired": false,
// "expirationDate": "2020-10-10"
// },
// "usageStatus": {
// "usedSpaceKB": 262144,
// "maxSpaceKB": 1048576
// }
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
let username = j_resp.string_of("username").unwrap_or_default();
let pec = j_resp.string_of("pec").unwrap_or_default();
let user_description = j_resp.string_of("userDescription").unwrap_or_default();
let country_code = j_resp.string_of("countryCode").unwrap_or_default();
let vat_code = j_resp.string_of("vatCode").unwrap_or_default();
let fiscal_code = j_resp.string_of("fiscalCode").unwrap_or_default();
let account_status_expired = j_resp.bool_of("accountStatus.expired");
let account_status_expiration_date = j_resp.string_of("accountStatus.expirationDate").unwrap_or_default();
let usage_status_used_space_kb = j_resp.int_of("usageStatus.usedSpaceKB");
let usage_status_max_space_kb = j_resp.int_of("usageStatus.maxSpaceKB");