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: 

REST API doesn't work in TeamCity build

rezeda mindubaeva
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!
February 26, 2021

So here's the problem:

I try to get some info from confluence page using python requests.

The code looks something like this

requests.get(f"{confluence_url}/rest/api/content/{page_id}",
auth=(USER, PWD),
params={'expand': 'version,body.storage'})

URL: https://confluence.mycompany.com/rest/api/content/(page_id)?expand=version%2Cbody.storage

I can access the page locally and it works just fine, even with the basic auth.

But when I try to run TC build that executes this code (using the same credentials) I get the following error:

{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"No content found with id: ContentId{id=(page_id))}","reason":"Not Found"}

Although this page exists and judging by log, URL is not modified in any way.

This TC build also uses other Atlassian rest apis (jira, bitbucket) and there are no errors.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Fabian Lim
Community Champion
December 24, 2021

HI @rezeda,

Try the recommendations posted in here and see if they resolve your issue: https://community.atlassian.com/t5/Confluence-questions/Unable-to-find-space-through-REST-API-in-postman-but-working/qaq-p/1084773

Regdrs

TAGS
AUG Leaders

Atlassian Community Events