Test
Qredo provides a tool to assist with signing your signature and testing your integration. There is also a Sandbox environment to test within. This page describes the testing tool.
Prerequisites¶
- You have created your API key and secret.
- You are comfortable sending headers:
- Signature:
qredo-api-sig
- Timestamp:
qredo-api-ts
- API key:
qredo-api-key
- Signature:
Enable testnet assets
While not mandatory, Qredo strongly recommends you perform API tests using testnet assets.
User API tool¶
The API tool is for tests only
The API tool is provided by Qredo for illustrative purposes. We do not recommend its use for operations on production.
The User API tool:
- Signs API requests
- Submits signed API requests to Qredo
- Is available both in CLI and as a simple web UI
This utility is written in Golang and hosted on GitHub. You are welcome to clone or fork the tool to adapt it to your needs when building your custom client for signing and sending requests.
Set up the API tool¶
Prerequisite met?
Yes
To build and run the Signing Client, you must have Golang installed. Using a CLI, check if you have Golang installed and verify the version:
go version
1. Clone locally the API Tool repo.
2. Navigate to the local
apitool
repository.
3. Using the CLI, build the API Tool to work with your keys:
Linux/Mac/Windows PowerShell/Git Bash:
go build -o apitool
Windows:go build -o apitool.exe
The CLI prints out a message about the apitool executable location. You can now proceed with testing out the API Tool.
Sign requests using the Qredo API Tool¶
In the CLI, run the following command:
Sign API requests in CLI
You can also use this command on Windows using PowerShell / Git Bash:
./apitool -api-key 9OgjbzwhoE4LJA \
-secret JDJhJDA0JHRmSmlkRmp2TEZkMVhmb3ExVTAzWGVKVUV3by8vdERqOFZCNHlzaWZWYjBzOG9BcWU4a0Uu \
-method GET \
-url https://api.qredo.network/qapi/v1/balance sign
qredo-api-sign
header) and the timestamp (qredo-api-ts
header):
qredo-api-sign: Kbj4AxSlgbL0-KA47kBwa0c7XLgX7cWUi00NMXYV5jA
qredo-api-key: 9OgjbzwhoE4LJA
qredo-api-ts: 1647438269
Use command prompt: cmd.exe
:
apitool -api-key 9OgjbzwhoE4LJA -secret JDJhJDA0JHRmSmlkRmp2TEZkMVhmb3ExVTAzWGVKVUV3by8vdERqOFZCNHlzaWZWYjBzOG9BcWU4a0Uu -method GET -url https://api.qredo.network/qapi/v1/balance sign
qredo-api-sign
header) and the timestamp (qredo-api-ts
header):
qredo-api-sign: Kbj4AxSlgbL0-KA47kBwa0c7XLgX7cWUi00NMXYV5jA
qredo-api-key: 9OgjbzwhoE4LJA
qredo-api-ts: 1647438269
You can now proceed to send a request.
Send requests using the Qredo API Tool¶
In the CLI, run the following command:
Send API requests in CLI
You can also use this command on Windows using PowerShell / Git Bash:
./apitool -api-key 9OgjbzwhoE4LJA \
-secret
JDJhJDA0JHRmSmlkRmp2TEZkMVhmb3ExVTAzWGVKVUV3by8vdERqOFZCNHlzaWZWYjBzOG9BcWU4a0Uu \
-method GET \
-url https://api.qredo.network/qapi/v1/balance send
{"assets":{"ETH-TESTNET":{"total":1800000000,"available":1800000000,"pendingIn":0,"pendingOut":0,"scale":1000000000}}}
Use command prompt: cmd.exe
:
apitool -api-key 9OgjbzwhoE4LJA -secret JDJhJDA0JHRmSmlkRmp2TEZkMVhmb3ExVTAzWGVKVUV3by8vdERqOFZCNHlzaWZWYjBzOG9BcWU4a0Uu -method GET -url https://api.qredo.network/qapi/v1/balance send
{"assets":{"ETH-TESTNET":{"total":1800000000,"available":1800000000,"pendingIn":0,"pendingOut":0,"scale":1000000000}}}
Sign and send requests via Web UI¶
The API tool initiates a locally-served Web UI providing simple controls to sign and send API calls.
Start the API Tool Web UI¶
In the CLI, run the following command:
Run Web UI API tool
You can also use this command on Windows using PowerShell / Git Bash:
./apitool ui
WebUI listening on http://127.0.0.1:4569
Use command prompt: cmd.exe
:
apitool ui
WebUI listening on http://127.0.0.1:4569
Sign and send requests¶
The Web UI supports:
-
Signing a request
- Click Sign The application returns the API call signature and timestamp.
-
Sign and send a request
- Click Send The application returns the API call signature and timestamp plus the HTTP response body.
With the Web UI running, open the local host location http://127.0.0.1:4569 in your favorite browser and follow these steps:
- Enter your API key and API secret created in the Qredo Web App.
- Enter the full URL path of your selected API endpoint. For example, with
GET /balance
, enterhttps://api.qredo.network/qapi/v1/balance
. - Select the HTTP method of the API request you want to send. For example, with
GET /balance
, set this value toGET
. - If the request contains a payload, enter this into the Body text box.
- Click Send.
Results are displayed in two sections of the screen:
-
To the right of the Body text box, you can observe your API key shown as (
Qredo-API-Key
), the API call timestamp (Qredo-API-Ts
), and the API call signature (Qredo-API-Sig
). -
Below the buttons Send and Sign, the web UI API tool prints out the response JSON body.
- Enter your API key and API secret created in the Qredo Web App.
- Enter the full URL path of your selected API endpoint. For example, with
GET /balance
, enterhttps://api.qredo.network/qapi/v1/balance
. - Select the HTTP method of the API request you want to send. For example, with
GET /balance
, set this value toGET
. - If the request contains a payload, enter this into the Body text box.
- Click Sign. The API tool Web UI prints out the results to the right of the screen including: your
Qredo-API-Key
, theQredo-API-Ts
timestamp and the API call signature, shown as the value for Qredo-API-Sig.