Request

Endpoint: !getAccountBalance

https://secure.trust-provider.com/products/!getAccountBalance

Use the POST method for this endpoint.

Submit parameters in the x-www-form-urlencoded format.

Request parameters

The following table lists the required and optional parameters.

Parameter Requirement Type Max.Length Description

loginName

required

string

64 chars

Your account username.

This value is case sensitive.

loginPassword

required

string

128 chars

Your account password.

This value is case sensitive.

responseFormat

optional

char

1 chars

Specifies the response format.

The possible values are:

  • 0 — Newline-delimited parameters.

  • 1 — URL-encoded parameters.

If omitted, the value defaults to 0.

Sample request

curl --location 'https://secure.trust-provider.com/products/!getAccountBalance' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'loginName=login_name' \
--data-urlencode 'loginPassword=login_password'

Response

The request is successful when the server returns a response with the status code 0.

Any errorCode less than 0 indicates an error condition.

The list of codes and their descriptions can be found in Error codes.

The user can change the response format by adding the responseFormat parameter to the request.

Response parameters

The response may contain the following parameters:

Parameter Response Format Description

responseFormat=0 (default)

text/plain

Returns a line-based response.

Success:

  • The first line contains status code 0.

  • The second line contains the ID of the Account.

  • The third line contains a sequence of letters used to represent the name of a monetary unit.

  • The fourth line contains the amount of money in the account.

  • The fifth line contains the hard credit limit of the account.

Failure:

  • The first line contains the error code.

  • The second line contains the error message.

responseFormat=1

application/x-www-form-urlencoded

Returns a URL-encoded response containing named parameters.

Success:

  • The response contains the following values:

    • errorCode=0: The request is successful.

    • accountID: The ID of the account that is currently logged in.

    • currencyCode: A sequence of letters representing the name of a monetary unit.

    • amount: The amount of money in the account.

    • hardCreditLimit: The hard credit limit of the account.

Failure:

  • The response contains the errorCode and errorMessage fields.

responseFormat=2

json

Returns a JSON object containing named parameters.

Success:

  • The response contains the following values:

    • errorCode=0: The request is successful.

    • accountID: The ID of the account that is currently logged in.

    • currencyCode: A sequence of letters representing the name of a monetary unit.

    • amount: The amount of money in the account.

    • hardCreditLimit: The hard credit limit of the account.

Failure:

  • The response contains the errorCode and errorMessage fields.

Sample success response

{
    "errorCode": 0,
    "accountID": "1111111111",
    "currencyCode": "GBP",
    "amount": "111111",
    "hardCreditLimit": "11"
}

Sample error response

{
    "errorCode": -4,
    "errorMessage": "The value of the 'includeTier2Accounts' argument is invalid!"
}

Error codes

The following table outlines error responses returned by the getAccountBalance API endpoint. Each error response consists of an errorCode and an errorMessage indicating why the request failed.

Error Code Error Message Description

-1

Request was not made over https!

The request must use HTTPS protocol.

-3

The 'xxxx' argument is missing!

The required argument is missing from the request.

-4

The value of the 'xxxx' argument is invalid!

The argument value does not meet validation requirements.

-14

An unknown error occurred!

An unknown error occurred.

-16

Permission denied!

The user does not have permission for the requested content.

-17

Request used GET rather than POST!

The request method should be POST.

-19

Only for CCM accounts!

The API is only available for SCM accounts.

-42

Call limit reached!

The API call limit has been reached.