javascriptjavajquerypostman

Automatically place response item into next request (raw --> x-www-form) (POSTMAN)


In POSTMAN, I'm having difficultly finding a way to place an item received from a JIRA Issue response(JSON) to the next request. BUT placing this item under (x-www-form-urlencoded) as a 'value' in the next request.

I'm including a few screen shots below to give a better visual of what I'm doing. However what I can't seem to figure out is a way to place that item as a value in (x-www.form...) format of the next request from an environment variable standpoing.

Context:

I've set up automation tests in POSTMAN which count any failures, save those failures to a variable. At the end of the Collection run, a JIRA REST API request is sent to create an Issue if those failures > 0. Furthermore, if the JIRA request is initiated, it will return the JIRA issue link inside the response. I've used an environment variable to get receive the link under "self".

enter image description here

So, whats confusing me is that to send a message to Slack through Slacks API, it goes under the format: x-www-form-urlencoded. Under this format, there are 3 KEYs needed to successfully send a slack message:

 KEY            VALUE
Token       (Authorization)
Channel     (Channel ID)
Text        (The Message)

I input all the necessary items in its respected places to send a message. The message works successfully however it does not include the env variable I set in the prior request in the Collection run. I hope would be that this would add the Jira issue link to the slack message so I'm able to click the link from there.

enter image description here

My question is, why isn't the env variable saving the response data and adding it to the next request which is the Slack Message?


Solution

  • To use variable in Postman UI, not Postman script (Pre-quest, Test), you need follow the syntax {{variable_name}}. In this case, you should use {{Link}}, not Link