Manually formatting WebResponse to JSON in Automation
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
When using the {{webResponse.body}} Smart Value from a web request in an Automation rule, Jira does not return it in JSON format - although the WebResponse value is in JSON when using the browser or a different tool.
To get the value in JSON, you can manually format it as shown below.
How To Replicate
For this scenario, we are using Jira REST API to get the values. This may vary depending on how your application is configured.
- Create an automation rule that sends a web request
- Include the response body in a comment action
- Observe that it's not in JSON format
Workaround
To work around it, you will need to manually format it including the smart value for each field returned:
When this is done, the response body will be added in the correct JSON format.
TIP: When working with web requests, you can also see some information regarding how to use the web response data here:
Relevant pages:
- Issue data (Jira format) payload for Send Web Request action
- Automation for Jira - Send web request using Jira REST API