Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

use web request response on a second web request

David Jose Silva Ruiz
Contributor
January 14, 2022

So I'm trying to create a complex rule (if you're wondering, is related to Grafana), 

1. first call an endpoint to get a very large JSON response (more than 4k lines)

2. use that JSON to call another endpoint....

that's it! it's simple in reality, but the problem is when using that json response as the custom data for the second request...

1. in that json response, I need to update a single line

2. Jira inputs it as "string" instead of a json object

I get this error in the Audit log

Send web request

Error response HTTP body:

[{"classification":"DeserializationError","message":"invalid character ',' looking for beginning of object key string"},{"fieldNames":["Dashboard"],"classification":"RequiredError","message":"Required"}]


Error publishing web request. Response HTTP status:
400

 

I tried these, according to the documentation, but they didn't work.... they print a blank string instead of parsing the json object

webhookResponse.body.dashboard.annotations.asJsonObject("annotations")
{{webhookResponse.body.dashboard.annotations.asJsonObject("annotations")}}
------
webhookResponse.body.dashboard.annotations.asJsonObjectArray("annotations")
{{webhookResponse.body.dashboard.annotations.asJsonObjectArray("annotations")}}

this is the expected result from above snippet

"annotations": {

"list": [

{

"datasource": "-- Grafana --",

"enable": true,

"hide": true,

"iconColor": "#5794F2",

"limit": 100,

"matchAny": true,

"name": "releases",

"showIn": 0,

"tags": [

"release"

],

"type": "tags"

},

{

"builtIn": 1,

"datasource": "-- Grafana --",

"enable": true,

"hide": true,

"iconColor": "rgba(0, 211, 255, 1)",

"limit": 100,

"name": "Annotations & Alerts",

"showIn": 0,

"type": "dashboard"

}

]

}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events