This article describes the WAPI commands for the WEDOS credit account. WAPI setup, authentication and troubleshooting are covered in WAPI – Manual. The full list of codes is in WAPI – Response Codes.
This article covers the following commands:
- account-list – list of credit account transactions
- credit-info – current credit account balance
General information
- Names: parameter and item names in JSON (
date_from,type,blocked…) must be used exactly as shown in this article. - Credit account: the credit account and how to top it up are described in WEDOS Credit Account.
account-list
Use account-list to get a list of credit account transactions for the selected period.
Parameters
- date_from = start date in YYYY-MM-DD format (required)
- date_to = end date in YYYY-MM-DD format (required). Transactions from the whole of this day are included.
date_from must not be later than date_to.
Return codes
- 1000 = OK
- 3004 = the start or end date is missing
- 3005 = invalid date, or date_from is later than date_to
Response data
Transactions in data are keyed by transaction ID. If there is no transaction in the period, data is empty.
- ID = transaction ID
- type = transaction type:
payment,deposit,return(refund) - num = order number
- description = description
- amount = amount
- bill_num = invoice number
- bill_date = invoice date
- blocked = blocked amount (1 = yes, 0 = no)
- created_date = date and time of the transaction
Templates
JSON request:
{
"request": {
"user": "your@login.tld",
"auth": "generated auth string",
"command": "account-list",
"clTRID": "your request id",
"data": {
"date_from": "YYYY-MM-DD",
"date_to": "YYYY-MM-DD"
}
}
}
JSON response (OK):
{
"response": {
"code": 1000,
"result": "OK",
"timestamp": "UNIX time",
"clTRID": "your request id",
"svTRID": "server request id",
"command": "account-list",
"data": {
"12345": {
"ID": "12345",
"type": "payment",
"num": "order number",
"description": "description",
"amount": "amount",
"bill_num": "invoice number",
"bill_date": "YYYY-MM-DD",
"blocked": 0,
"created_date": "YYYY-MM-DD HH:MM:SS"
}
}
}
}
credit-info
Use credit-info to get the current credit account balance.
A test request ("test": 1) returns only the return code, without the balance.
Parameters
The command has no parameters.
Return codes
- 1000 = OK
- 5002 = internal error while getting the balance
Response data
- amount = credit account balance
- currency = credit account currency
Templates
JSON request:
{
"request": {
"user": "your@login.tld",
"auth": "generated auth string",
"command": "credit-info",
"clTRID": "your request id"
}
}
JSON response (OK):
{
"response": {
"code": 1000,
"result": "OK",
"timestamp": "UNIX time",
"clTRID": "your request id",
"svTRID": "server request id",
"command": "credit-info",
"data": {
"amount": "balance",
"currency": "currency code"
}
}
}