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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I want to read content from my organization a confluence page using REST api through python

my code looks like this:

import requests
from requests.auth import HTTPBasicAuth
contentApiUrl = '/rest/api/content'
# Change these based on your instance
confluenceBaseUrl = 'https://confluence.abc......'
pageId = '26586726'
username = '****'
password = '*****'

requestUrl = '{confluenceBaseUrl}{contentApiUrl}/{pageId}/?expand=body.storage'.format(confluenceBaseUrl = confluenceBaseUrl, contentApiUrl = contentApiUrl, pageId = pageId)
print (requestUrl)

requestResponse = requests.get(requestUrl, auth=HTTPBasicAuth(username, password))
print(requestResponse)
print(requestResponse.content)

 output:

<Response [404]>
b'{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"No content found wit
h id: ContentId{id=26586726}","reason":"Not Found"}'

The pageId , userid and password is correct.

but the catch is when i hit the url mentioned in requestUrl through browser it return the JSON but when i call the url through it gives 404 error. 

1 answer

0 votes
edwin Community Leader Feb 05, 2021

Hi @shantanu kumar ,

Please confirm that you have access to the page. The documentation states:

STATUS 404 - Returned if there is no content with the given id, or if the calling user does not have permission to view the content.

@edwin yes, I can access the confluence page through browser.   

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

101 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you