Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,867
Community Members
 
Community Events
184
Community Groups

Report variables as JSON in HTTP Post Payload

Hello, I am running into an issue. I am trying to use the Pattern utility to generate JSON which is then integrated into a larger JSON blob within my HTTP Payload. It looks like, according to the documentation, that the variable is auto-escaped when included in the payload section.

I am trying to generate a custom Slack webhook message, and I am getting invalid JSON errors when attempting to do this for example:

testreport = {"text":"test"}
Payload = {$testreport}

Is there any advice on this? Is there an equivalent for variables akin to the _html option like {$testreport_string} which does no modification to the data coming out of the report?

1 answer

0 votes
milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2023

@Alex K_ 

The report variable when fed through the http request payload is a string. Typically I will do a split by "\n" and process each line of the report accordingly. This will depend on your pattern.

The pattern I presented above has no "\n" characters. It is just a single line of JSON in a Trello variable being referenced in the payload.

From the documentation: 

Variables that are used in the URL are automatically URL-encoded to create valid URLs; variables used in the payload are automatically escaped to be part of a valid JSON string.

I am assuming that my would be valid JSON is getting converted to:

{\"text\":\"test\"}

 Which I unfortunately don't want.

milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2023

@Alex K_ 

{$reportvariable} by itself is a string and the value depends on the your criteria and pattern in your command. You can use it is a payload in http request e.g {"somekey" : "{$reportvariable}" } to your endpoint. 

That is unfortunately not the use case I am looking for. I guess my problem is more of a feature request then.

With a variable of:


{$reportvariable} == "text":"test"

I want to be able to have the payload be:


{"somekey":"hello world", {$reportvariable}}

Which would result in a payload of:


{"somekey":"hello world", "text":"test"}

 
I will try and look for a different solution.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events