Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Here’s an outline with best practices for making your inquiry.
I’m using postman for an api request. My question is; I’m getting an error when I made one of the variables random.
If it works when it’s not randomised, then it sounds like the issue is with {{transactionId} rather than the authorisation per se as it works when the transaction ID is hardcoded into the URL.
What does the console log look like for the request?
Is it actually adding the number to the request?
And I think question is how to change url of request in collection pre- request script? Because hmac calculation is in the collection pre request script. So the flow is starting there. For this reason it’s coming like this {{transaction_id}}. But I have to set on request url a random number in collection pre-request script before send a request.
var signature = pm.request.method + "\n" + pm.request.url.getPath().slice(0,-17) + random + "\n" + nonce + "\n";
This will trim the “{{transactionId}}” (17 characters) which is being passed as a string because the action to save the value hasn’t happened yet. It then adds ‘random’ which is the same value you are planning to store to the ‘transactionId’ variable.