The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to get page body from search REST API

Ran Bi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 16, 2024

I am trying to search a CQL query and fetch all bodies of pages in search result using REST API with following code:

 

requests.get(f'{base_url}/wiki/rest/api/search', 
auth=...,
params={
'cql': cql,
"expand": "body.view"
},
headers={
"Accept": "application/json",
})

However, body in result pages are empty strings.

Did I miss anything?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Andrii Maliuta
Contributor
April 16, 2024

Hello @Ran Bi ,

As search results are displayed as 'content' elements, you should add it for expand parameter. E.g.:

"expand": "content.body.view"

 

Ran Bi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2024

Wow it works. Thanks, Andrii!

Like Andrii Maliuta likes this
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events