Skip to content

Latest commit

 

History

History
107 lines (72 loc) · 2.52 KB

api.md

File metadata and controls

107 lines (72 loc) · 2.52 KB

API documentation

More exhaustive API documentation can be found in openapi.yaml

Contents

Methods

List Accounts

Fetches all accounts in the system. Returns only account IDs

GET /accounts

Returns an array of strings

Create Account

Creates new account with specified ID, currency and balance

POST /accounts

JSON object:

Field Type Description Optional
id string Account ID, must be unique no
currency string Account's currency no
balance number Account's initial balance. Can't be negative no

Returns created Account

Get Account

Fetches existing account data.

GET /accounts/:id

Path parameter:

Field Description Optional
id Account ID no

Returns found Account

Get Payments

Fetches payments related to specified account.

GET /accounts/:id/payments

Path parameter:

Field Description Optional
id Account ID no

Returns an array of Payments

Make Payment

Makes new payment from one account to another.

POST /accounts/:id/payments

Path parameter:

Field Description Optional
id ID of account who will be the source of payment no

JSON object:

Field Type Description Optional
id string (guid) Unique ID of payment that must be generated by client. Helps to avoid payment duplication. no
to_account string ID of recipient's account no
amount number Amount of money to transfer no

Returns created Payment

Entities

Account

Attribute Description Nullable
id Unique string ID of Account no
currency Account's currency no
balance Balance of Account no

Payment

Attribute Description Nullable
account Account ID to which this payment relates to no
amount Transferred funds no
direction Direction of payment: "outgoing" or "incoming" no
from_account Source account ID of the payment if direction is "incoming" yes
to_account Destination account ID of the payment if direction is "outgoing" yes