Rust
Rust
Yapily - Get Application Self
See more Yapily Examples
Get the information about the institutions configured in your applicationChilkat 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 -i -X GET \
// -u <username>:<password> \
// https://api.yapily.com/me
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
http.set_login("<username>");
http.set_password("<password>");
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://api.yapily.com/me", &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)
// {
// "uuid": "64949de6-6510-4d70-9500-d4aa094c506c",
// "name": "APPLICATION NAME",
// "active": true,
// "authCallbacks": [
// "https://display-parameters.com/"
// ],
// "institutions": [
// {
// "id": "modelo-sandbox",
// "name": "Modelo Sandbox",
// "fullName": "Modelo Sandbox",
// "countries": [
// {
// "displayName": "United Kingdom",
// "countryCode2": "GB"
// }
// ],
// "environmentType": "SANDBOX",
// "credentialsType": "OPEN_BANKING_UK_AUTO",
// "media": [
// {
// "source": "https://images.yapily.com/image/ce2bfdbf-1ae2-4919-ab7b-e8b3d5e93b36?size=0",
// "type": "icon"
// },
// {
// "source": "https://images.yapily.com/image/ca502f24-d6df-4785-b4b8-1034b100af77?size=0",
// "type": "logo"
// }
// ],
// "features": [
// "INITIATE_SINGLE_PAYMENT_SORTCODE",
// "CREATE_DOMESTIC_PERIODIC_PAYMENT",
// "ACCOUNT_REQUEST_DETAILS",
// "ACCOUNT_STATEMENT_FILE",
// "CREATE_SINGLE_PAYMENT_SORTCODE",
// "ACCOUNTS",
// "CREATE_DOMESTIC_SCHEDULED_PAYMENT",
// "ACCOUNT_PERIODIC_PAYMENTS",
// "CREATE_DOMESTIC_SINGLE_PAYMENT",
// "INITIATE_DOMESTIC_PERIODIC_PAYMENT",
// "EXISTING_PAYMENTS_DETAILS",
// "INITIATE_BULK_PAYMENT",
// "EXISTING_PAYMENT_INITIATION_DETAILS",
// "ACCOUNT_DIRECT_DEBITS",
// "ACCOUNT_TRANSACTIONS",
// "INITIATE_DOMESTIC_SINGLE_PAYMENT",
// "PERIODIC_PAYMENT_FREQUENCY_EXTENDED",
// "CREATE_INTERNATIONAL_SINGLE_PAYMENT",
// "ACCOUNT_SCHEDULED_PAYMENTS",
// "ACCOUNT",
// "ACCOUNT_STATEMENTS",
// "ACCOUNT_TRANSACTIONS_WITH_MERCHANT",
// "CREATE_BULK_PAYMENT",
// "ACCOUNT_BALANCES",
// "INITIATE_INTERNATIONAL_SINGLE_PAYMENT",
// "INITIATE_DOMESTIC_SCHEDULED_PAYMENT",
// "ACCOUNT_BENEFICIARIES",
// "IDENTITY",
// "ACCOUNT_STATEMENT",
// "INITIATE_ACCOUNT_REQUEST"
// ]
// }
// ],
// "media": [
// ],
// "created": "2020-11-09T10:05:29.897+0000",
// "updated": "2021-04-14T12:51:07.419+0000"
// }
// 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 mut j: i32 = 0;
let mut count_j: i32 = 0;
let uuid = j_resp.string_of("uuid").unwrap_or_default();
let mut name = j_resp.string_of("name").unwrap_or_default();
let active = j_resp.bool_of("active");
let created = j_resp.string_of("created").unwrap_or_default();
let updated = j_resp.string_of("updated").unwrap_or_default();
let mut i = 0;
let mut count_i = j_resp.size_of_array("authCallbacks");
while i < count_i {
j_resp.set_i(i);
let _ = j_resp.string_of("authCallbacks[i]").unwrap_or_default();
i = i + 1;
}
i = 0;
count_i = j_resp.size_of_array("institutions");
while i < count_i {
j_resp.set_i(i);
let _ = j_resp.string_of("institutions[i].id").unwrap_or_default();
name = j_resp.string_of("institutions[i].name").unwrap_or_default();
let _ = j_resp.string_of("institutions[i].fullName").unwrap_or_default();
let _ = j_resp.string_of("institutions[i].environmentType").unwrap_or_default();
let _ = j_resp.string_of("institutions[i].credentialsType").unwrap_or_default();
j = 0;
count_j = j_resp.size_of_array("institutions[i].countries");
while j < count_j {
j_resp.set_j(j);
let _ = j_resp.string_of("institutions[i].countries[j].displayName").unwrap_or_default();
let _ = j_resp.string_of("institutions[i].countries[j].countryCode2").unwrap_or_default();
j = j + 1;
}
j = 0;
count_j = j_resp.size_of_array("institutions[i].media");
while j < count_j {
j_resp.set_j(j);
let _ = j_resp.string_of("institutions[i].media[j].source").unwrap_or_default();
let _ = j_resp.string_of("institutions[i].media[j].type").unwrap_or_default();
j = j + 1;
}
j = 0;
count_j = j_resp.size_of_array("institutions[i].features");
while j < count_j {
j_resp.set_j(j);
let _ = j_resp.string_of("institutions[i].features[j]").unwrap_or_default();
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = j_resp.size_of_array("media");
while i < count_i {
j_resp.set_i(i);
i = i + 1;
}