Assumes a BITTREX_API_KEY
and BITTREX_API_SECRET
is set on the collections variables.
// set up vars
let timestamp = new Date().getTime()
let url = request['url']
let method = request['method']
let contentHash = CryptoJS.SHA512(request['data']).toString(CryptoJS.enc.Hex);
var preSign = [timestamp, url, method, contentHash, ''].join('');
var signature = CryptoJS.HmacSHA512(preSign, pm.collectionVariables.get("BITTREX_API_SECRET")).toString(CryptoJS.enc.Hex);
// Api-Key
pm.request.headers.add({
key: 'Api-Key',
value: pm.collectionVariables.get("BITTREX_API_KEY")
});
// Api-Timestamp
pm.request.headers.add({
key: 'Api-Timestamp',
value: timestamp
});
// Api-Content-Hash
pm.request.headers.add({
key: 'Api-Content-Hash',
value: contentHash
});
// Api-Signature
pm.request.headers.add({
key: 'Api-Signature',
value: signature
});