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

About getting webResponse value

青山 明 January 14, 2022

I'm using the confluence API. As a response value to the https GET request Suppose you want to get the following data example.

body = {results = [{ope = abc, rest = {user = {results = [{xxx, Id = 12345}]}}, ope = def, rest = {user = {results = [{xxx, Id = 67890}]}}]}

I want to get only Id = 12345 from the above data example. If you specify "body.results.rest.user.results.Id", two Id = 12345 and Id = 67890 will be specified.

If you want to get only the first Id = 12345, you will get it. How should I modify "body.results.rest.user.results.Id"?

1 answer

1 accepted

3 votes
Answer accepted
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2022

Hi @青山 明 

Use jq tool to extract data from JSON Body

Please find the reference here for documentation

https://stedolan.github.io/jq/manual/#Basicfilters

Thanks,
Pramodh

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2022

@青山 明 

In your case, it should be modified as an array to get the data for the first id

青山 明 January 14, 2022

I would like you to give a concrete example.

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2022

@青山 明 

Would you please give me the exact JSON response? I would give an answer to the requirement you need

青山 明 January 15, 2022

Please use the example below.

body = {results = [{ope = abc, rest = {user = {results = [{xxx, Id = 12345}]}}, ope = def, rest = {user = {results = [{xxx, Id = 67890] }]}}]}

How can I modify the smart values below?

{{body.results.rest.user.results.Id}}

青山 明 January 15, 2022

Is there anything in my question that doesn't make sense?

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2022

@青山 明 

JSON body contains = which shouldn't be

I am confused on how to get the data

青山 明 January 15, 2022

Shows some of the "webResponse" information after the response.

I am trying to get data based on that information.

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2022

Could you please include the screenshot of the response so that I can have a look at it please

青山 明 January 15, 2022

Was self resolved.  thankyou

Like Pramodh M likes this
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2022

Could you please include the answer as well so that it can help others in community!!

Like Cindy Li likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events