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

1 vote
Andrii Maliuta 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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events