Sample code for 30+ languages & platforms
React Native

Yapily - Get Application Self

See more Yapily Examples

Get the information about the institutions configured in your application

Chilkat React Native Downloads

React Native
import { Http, JsonObject, StringBuilder } from '@chilkat/react-native'

async function chilkatExample() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  const http = new Http();

  // 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.login = '<username>';
  http.password = '<password>';

  const sbResponseBody = new StringBuilder();
  try {
    await http.quickGetSbAsync('https://api.yapily.com/me', sbResponseBody);
  } catch {
    console.log(http.lastErrorText);
    return;
  }

  const jResp = new JsonObject();
  jResp.loadSb(sbResponseBody);
  jResp.emitCompact = false;

  console.log('Response Body:');
  console.log(jResp.emit());

  const respStatusCode = http.lastStatus;
  console.log(`Response Status Code = ${respStatusCode}`);
  if (respStatusCode >= 400) {
    console.log('Response Header:');
    console.log(http.lastHeader);
    console.log('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 strVal = '';
  let id = '';
  let fullName = '';
  let environmentType = '';
  let credentialsType = '';
  let j = 0;
  let countJ = 0;
  let displayName = '';
  let countryCode2 = '';
  let source = '';
  let vType = '';

  const uuid = jResp.stringOf('uuid');
  let name = jResp.stringOf('name');
  const created = jResp.stringOf('created');
  const updated = jResp.stringOf('updated');
  let i = 0;
  let countI = jResp.sizeOfArray('authCallbacks');
  while (i < countI) {
    jResp.i = i;
    strVal = jResp.stringOf('authCallbacks[i]');
    i++;
  }

  i = 0;
  countI = jResp.sizeOfArray('institutions');
  while (i < countI) {
    jResp.i = i;
    id = jResp.stringOf('institutions[i].id');
    name = jResp.stringOf('institutions[i].name');
    fullName = jResp.stringOf('institutions[i].fullName');
    environmentType = jResp.stringOf('institutions[i].environmentType');
    credentialsType = jResp.stringOf('institutions[i].credentialsType');
    j = 0;
    countJ = jResp.sizeOfArray('institutions[i].countries');
    while (j < countJ) {
      jResp.j = j;
      displayName = jResp.stringOf('institutions[i].countries[j].displayName');
      countryCode2 = jResp.stringOf('institutions[i].countries[j].countryCode2');
      j++;
    }

    j = 0;
    countJ = jResp.sizeOfArray('institutions[i].media');
    while (j < countJ) {
      jResp.j = j;
      source = jResp.stringOf('institutions[i].media[j].source');
      vType = jResp.stringOf('institutions[i].media[j].type');
      j++;
    }

    j = 0;
    countJ = jResp.sizeOfArray('institutions[i].features');
    while (j < countJ) {
      jResp.j = j;
      strVal = jResp.stringOf('institutions[i].features[j]');
      j++;
    }

    i++;
  }

  i = 0;
  countI = jResp.sizeOfArray('media');
  while (i < countI) {
    jResp.i = i;
    i++;
  }
}