Version: current

STEP 3 - Create Core Client

Create a Core Client to enable you to listen to actions via a Websocket Feed. A Core Client acts as an automated Custodian for transactions.

OPTIONAL but RECOMMENDED.

The only required field for a Core Client is name.

Example create a core client request#

curl -X POST "https://api.qredo.network/api/v1/p/coreclient"
-H "accept: application/json" \
-H "x-nonce: <ENTER NONCE>" \
-H "x-timestamp: <ENTER TIMESTAMP>" \
-H "x-sign: <YOUR API AUTHENTICATION TOKEN>" \
-H "X-API-KEY: <YOUR API KEY AUTHORIZATION>" \
-H "Content-Type: application/json"
-d "{
"name": "meaningfulname",
}

Example response#

{
"id": "<CORE_CLIENT_ID>",
"name": "<MEANINGFULNAME>",
"feed": "<UNIQUE_WEBSOCKET_FEED>",
"timestamp": "<UNIQUE_TIMESTAMP>"
}

Connect to Core Client Websocket Feed#

The websocket feed offers real-time streaming event updates.

Using your chosen programming environment, listen to the Core Client's websocket URL (returned in the previous step)

wss://api.qredo.network/api/v1/p/coreclient/<CORE_CLIENT_ID>/feed

You must include the following headers:

"x-api-key": "your API key",
"x-sign": "the signature of the timestamp concatenated with the WSS URL",
"x-timestamp": "the timestamp used to generate the signature"

Example Golang#

Use our example Golang partner-api-sign client program

Required#

  • Golang

Create Connection#

  1. Clone the repo at https://github.com/qredo/partner-api-sign

  2. Change directory to the location where the repo is installed on your laptop.

cd partner-api-sign
  1. Build the sample app
go build -o partner-api-sign
  1. Listen to the websocket with the following command:

Linux/Mac

./partner-api-sign websocket -url wss://api.qredo.network/api/v1/p/coreclient/<CORE_CLIENT_ID>/feed

Windows

partner-api-sign.exe websocket -url wss://api.qredo.network/api/v1/p/coreclient/<CORE_CLIENT_ID>/feed
  1. You are successful when your CLI displays actions from the Core Client in compressed JSON format. See Example websocket response below

Example Python3#

Requirements#

  • Python >= 3.6.1

Prerequistes#

  • Install thewebsocketlibrary.
pip3 install websocket

Create Connection#

  1. Run the following example script:
from websocket import create_connection
ws = create_connection("wss://api.qredo.network/api/v1/p/coreclient/<CORE_CLIENT_ID>/feed", header={"x-api-key": "<YOUR_API_KEY>","x-sign": "<SIGNATURE>", "x-timestamp": "1111111111"})
while True:
result = ws.recv()
print (result)
  1. You are successful when your CLI displays actions from the Core Client in compressed JSON format.

Example websocket response#

  • id: Action ID
  • type: Action Type e.g. ApproveWithdraw, ApproveTransfer
  • status: The status of the action e.g. pending, expired, approved, rejected
  • timestamp: Time in epoch
  • expireTime: Time in epoch
{"id":", "<ACTION_ID>": ", "type": "<TYPE_OF_ACTION>", "status": ", "timestamp": , "expireTime": }

Websocket Requests#

How to get details of an action#

GET /coreclient/{client_id}/action/{action_id}

How to approve an action#

PUT /coreclient/{client_id}/action/{action_id}

How to reject an action#

DELETE /coreclient/{client_id}/action/{action_id}