General Info
General API Information
The base endpoint is: https://open-api.ceffu.com
All endpoints return either a JSON object
Data is returned in ascending order. Oldest first, newest last.
All time and timestamp related fields are in milliseconds.
2.1 API format
2.1.1 Response format
Field | Type | Mandatory | Remark |
---|---|---|---|
code | int | Y | 200 |
message | String | Y | success |
data | Object | Y |
2.1.2 Request Format
2.1.2.1 Header:
open-apikey:${apikey}
signature:${signature}
${apikey}
is the Public Key of the Key Pairs (API Key) generated in API Management Module.
signature:${signature}
is the signature generated by secret key and request content. (See section 1.2)
2.1.3 GET Request
Embed query string in URL
2.1.4 POST Request
Embed JSON object in https request body
2.1.5 Example
Python:
import json
import time
import urllib.parse
import requests
API_KEY = "API_KEY_HERE"
SECRET = "SECRET_HERE"
DOMAIN = "DOMAIN_HERE"
# GET EXAMPLE (get system status)
params = {
"bizType": 10,
"timestamp": int(time.time() * 1000), # TImestamp in milliseconds
"walletType": 10,
}
query_string = urllib.parse.urlencode(params)
signature = sign(query_string, SECRET)
r = requests.get(url=DOMAIN + "/open-api/v1/system/status", params=params,
headers={"open-apikey": API_KEY, "signature": signature})
print(r.json())
# POST EXAMPLE (create wallet)
body = {
"requestId": 1,
"timestamp": int(time.time() * 1000), # TImestamp in milliseconds
"walletName": "Shared Wallet - 1",
"walletType": 20
}
json_body = json.dumps(body)
signature = sign(json_body, SECRET)
r = requests.post(url=DOMAIN + "/open-api/v1/wallet/create", json=body,
headers={"open-apikey": API_KEY, "signature": signature})
print(r.json())
2.2 HTTP Return Codes and Error Codes
The Ceffu API returns the following HTTP status codes:
HTTP Status | Meanings | Description |
---|---|---|
200 | Success | The operation succeeded |
400 | Bad Request | The client request is invalid |
401 | Unauthorized | Authentication failed (e.g., invalid token specified by the Authorization header) |
403 | Forbidden | Authentication failed, but the operation is not allowed |
404 | Not Found | Requested resource does not exist |
429 | Too Many Requests | Client request rate exceeded the limit |
5xx | System error | |
2xx | Business error |
Error Codes and Messages
- If there is an error, the API will return an error with a message of the reason.
- Specific error codes and messages defined in Error Codes.
Detail error codes and messages will be supplemented later.
2.3 Pagination
For some cases, transactions history or wallet listing, may return an array of results, which require pagination.
By default, the API returns 25 results per request. The pagelimit
parameter can be used to increase the number of results per request, up to a maximum of 500. pageNo
allows for fetching results of the selected page of totalPage
.
Field | Type | Mandatory | Remark | Sample |
---|---|---|---|---|
pageLimt | integer | Y | pageLimit | 20 |
pageNo | integer | Y | pageNo | 1 |
totalPage | integer | Y | totalPage | 10 |