Postman is a popular API test environment that allows implementing and testing REST API endpoints.
Postman provides the HTTP networking to connect to the REST API, allows the HTTP headers and GET/POST data to be customised, and allows for custom code to be executed using a JavaScript variant.
Predefined implementations can be imported into Postman via collections (essentially a JSON file containing the configuration and code for each API endpoint).
The following are Postman collections for our exchange REST API and our futures REST API:
Note that the above collections are intended as demonstrations of API usage, hence they do not implement every available endpoint or every possible input parameter. Additional endpoints and parameters can be added to the collections by reviewing the appropriate API documentation and using the provided endpoints as examples.
For reference, the following is an example of the JSON content within a Postman collection:
{
"info": {
"_postman_id": "b530d6e8-8aa3-403d-b8ab-1665d4606eab",
"name": "Kraken REST API - GetWebSocketsToken Endpoint",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "GetWebSocketsToken",
"event": [
{
"listen": "prerequest",
"script": {
"id": "e11ed019-722d-4ecf-8ddf-1f724e5b1ab4",
"exec": [
"api_key = \"API PUBLIC KEY\"",
"api_secret = CryptoJS.enc.Base64.parse(\"API PRIVATE KEY\");",
"api_nonce = (Date.now() * 1000).toString();",
"api_endpoint = \"/0/private/GetWebSocketsToken\";",
"api_post = \"nonce=\" + api_nonce;",
"",
"api_sha256 = CryptoJS.SHA256(api_nonce + api_post);",
"api_sign = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA512, api_secret);",
"api_sign.update(api_endpoint, api_secret);",
"api_sign.update(api_sha256, api_secret);",
"api_sign = api_sign.finalize().toString(CryptoJS.enc.Base64);",
"",
"pm.globals.set(\"api_nonce\", api_nonce);",
"pm.globals.set(\"api_key\", api_key);",
"pm.globals.set(\"api_signature\", api_sign);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "API-Key",
"type": "text",
"value": "{{api_key}}"
},
{
"key": "API-Sign",
"type": "text",
"value": "{{api_signature}}"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "nonce",
"value": "{{api_nonce}}",
"type": "text"
}
]
},
"url": {
"raw": "https://api.kraken.com/0/private/GetWebSocketsToken",
"protocol": "https",
"host": [
"api",
"kraken",
"com"
],
"path": [
"0",
"private",
"GetWebSocketsToken"
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
}