Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

How can I access Confluence Page Content through the Confluence REST v2 API?

I am a community developer trying to build a Confluence app that must scrape textual page content. I am having trouble getting the actual page content.

 

I am able to successfully query pages using the pages endpoint (GET /wiki/api/v2/pages)

 

Here is the output

 

results: [
{
id: 98383,
version: [Object],
authorId: '6237c985ee1b5a0070273f6b',
title: 'Overview',
status: 'CURRENT',
body: {},
parentId: null,
spaceId: 98306,
createdAt: '2023-01-25T09:40:17.506Z'
}
...]

Notice here that body is empty! I have also tried using the solution here by trying to use the deprecated content endpoint, along with optional parameter `?expand=body.storage`

 

/wiki/api/v2/content/98533?expand=body.storage

 

This leads to a scope error:

{ code: 401, message: 'Unauthorized; scope does not match' }

 

I feel I have the right scopes, as I have reviewed the documentation extensively:

scopes:

- read:page:confluence

- read:content:confluence

- read:custom-content:confluence

- read:confluence-props

- read:confluence-content.all

- read:content-details:confluence

 

Can someone guide me here? I would really appreciate guidance on retrieving post content.

1 answer

1 vote
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 03, 2023

Hi @ruchirbaronia_gmail_com , welcome to the Community!

You're on the right track - the API endpoint you have will return the content if you specify the format you want the body in (either storage or atlas_doc_format) as the body-format query parameter. You can do this with either the /pages endpoint itself to get this for multiple pages at once, or by ID as you had in your example:

/wiki/api/v2/pages/98533?body-format=storage

If you pull the atlas_doc_format type, you can use this documentation and example libraries to parse the format as you need.

Cheers,

Daniel | Atlassian Staff

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events