Skip to content

Latest commit

 

History

History
148 lines (108 loc) · 3.86 KB

AccountsApi.md

File metadata and controls

148 lines (108 loc) · 3.86 KB

TransferzeroSdk.AccountsApi

All URIs are relative to https://api-sandbox.transferzero.com/v1

Method HTTP request Description
getAccount GET /accounts/{Currency} Fetches account balance for specified currrency
getAccounts GET /accounts Fetches account balances for all currencies

getAccount

AccountResponse getAccount(currency)

Fetches account balance for specified currrency

Fetches account balance for specified currrency, and returns current balance and associated currency code

Example

import { AccountsApi } from 'transferzero-sdk';

// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

let apiInstance = new AccountsApi(apiClient);

apiInstance.getAccount(currency).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  if (error.isValidationError) {
    let result = error.getResponseObject();
    console.log(result);
    console.error("WARN: Validation error occurred when calling the endpoint");
  } else {
    console.error("Exception when calling AccountsApi#getAccount");
    throw error;
  }
});

Parameters

Name Type Description Notes
currency String Currency code of account balance to fetch Example: `/v1/accounts/USD`

Return type

AccountResponse

Authorization

You can set the API Key and Secret by passing a config object when creating an ApiClient:

const apiClient = new ApiClient({
  apiKey: '<key>',
  apiSecret: '<secret>',
  basePath: 'https://api-sandbox.transferzero.com/v1'
});

Or by setting the properties on an ApiClient instance:

const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getAccounts

AccountListResponse getAccounts()

Fetches account balances for all currencies

Fetches account balances for all currencies, and returns an array of the current balances and associated currency codes.

Example

import { AccountsApi } from 'transferzero-sdk';

// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

let apiInstance = new AccountsApi(apiClient);
apiInstance.getAccounts().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  if (error.isValidationError) {
    let result = error.getResponseObject();
    console.log(result);
    console.error("WARN: Validation error occurred when calling the endpoint");
  } else {
    console.error("Exception when calling AccountsApi#getAccounts");
    throw error;
  }
});

Parameters

This endpoint does not need any parameter.

Return type

AccountListResponse

Authorization

You can set the API Key and Secret by passing a config object when creating an ApiClient:

const apiClient = new ApiClient({
  apiKey: '<key>',
  apiSecret: '<secret>',
  basePath: 'https://api-sandbox.transferzero.com/v1'
});

Or by setting the properties on an ApiClient instance:

const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json