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.
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
please refer to this https://thepythoncoding.blogspot.com/2023/05/how-can-i-access-confluence-page.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.