Setting a Postman collection variable from JSON response from AWS

Viewed 17

I'm trying to set a collection variable in Postman to store params from AWS.

The params in question from AWS all start with "x-amz", and when I try to store one of these values, the console only returns:

"ReferenceError: amz is not defined".

I'm trying to set it simply using the following:

let jsonData = JSON.parse(responseBody);

pm.collectionVariables.set("x-amz-algorithm", jsonData.multipart_params.x-amz-algorithm);

How can I set this value without triggering the ReferenceError?

1 Answers

x-amz-algorithm is not a valid attribute name because it contains -, the subtraction operator.

Try

jsonData.multipart_params["x-amz-algorithm"]
Related