Invoking an API sometimes needs a Signature to be passed as part of the request. Signature is MD5 or SHA256 hashed and is a concatenation of -
Client ID
Client Secret
Epoch time (rounded off to seconds as sample below)
Environment
ALL
Resolution
Generating Signature in Postman - Example API Call -
curl -X GET \ 'http://xxx.api.mashery.com/bhavani4?apiKey=<apiKey>&sig=588ab8ecbd5f7c435c0e3b14e1915fb2'
Here 'sig' query parameter is generated in Postman through Pre-request Script. Below is the script -
var mymd5str = CryptoJS.SHA256("<clientID>" + "<clientSecret>" + Math.round((new Date()).getTime()/1000)); // for MD5, use CryptoJS.MD5 postman.clearGlobalVariable("signature"); postman.setGlobalVariable("signature", mymd5str);
URL to be used in Postman - http://xxx.api.mashery.com/bhavani4?apiKey=<apiKey>&sig={{signature}} please note the {{signature}} element, it comes from the global variable defined in pre-request script.