Skip to content

REST API Spec

Chris Hager edited this page Nov 14, 2017 · 15 revisions

Table of Contents

General

API Requests


Error Handling

When an error occurs, all API requests return a 4xx status code and the following error payload:

{
  errorCode: int,       # error-code
  errorMessage: string  # description of the problem
}

API Authentication

All requests must send a valid access token in the HTTP header Authorization with this format: Bearer {access-token}. An example header would look like this:

Authorization: Bearer 0271b072-80bc-4231-9a73-1f11472fa7fd

If the API request does not include a valid access token, the REST api returns 403 Forbidden.


API Calls

Create wallet

Create a new wallet.

Request

POST /wallets/create
{
  password: string  # minimum 8 characters
}

Response

Success: 200 OK

{
  address: string
  nep2_key: string  # nep2 encrypted private key
}

Get $IMU balance of an address

Get the current $IMU balance of an address

Request

GET /imu/balance/{address}

Response

Success: 200 OK

{
  address: string
  balance: int
  updatedAt: int  # timestamp in seconds
}

Reward {address} with $IMU

Reward the specified address with $IMU

Request

POST /imu/reward
{
  address: string
}

Response

Success: 200 OK