We moved from self hosted to Atlassian hosted Confuence and I can't figure out how to update things using the REST api

I'm using python + requests, have read https://docs.atlassian.com/atlassian-confluence/REST/latest/ and https://developer.atlassian.com/confdev/confluence-rest-api/confluence-rest-api-examples but can't get it working.

I am new to REST but have been doing python for years so maybe there is something easy I'm missing.  When locally hosted, the provided python example worked simply substituting our domain.  Now I've substituted for the new domain but just get 404s back.  This is extremely frustrating.

3 answers

1 accepted

1 vote
Joe Clark Atlassian Team Apr 22, 2015

Hi @Pat Corwin,

Make sure you've got the REST API URLs correct - They will be of the form "https://<yourdomain>.atlassian.net/wiki/rest/api/latest/<method>"

People often forget the "/wiki" part when using the APIs in the Atlassian Cloud.

Cheers,
Joe. 

 

 

Thanks, "/wiki/" was totally it. It might be helpful to note that in either of the pages I linked to in the question. I didn't even notice that change and it appears others don't either.

0 vote

Hello Pat,

Thank you for your question.

As @Joe Clark [Atlassian] has mentioned, there are things to be considered, most likely the URL used and the context path (wiki).

Please, find below an example in Python to the /rest/api/content [GET]:

# ===============
# get content
# ===============
import requests
import json

# [CONFLUENCE-BASE-URL], i.e.: https://&lt;yourdomain&gt;.atlassian.net/wiki
url = '[CONFLUENCE-BASE-URL]/rest/api/content'
headers = {'Content-Type': 'application/json'}

# get content page
# [USERNAME], i.e.: myuser
# [PASSWORD], i.e.: passABC
r = requests.get(url, auth=('[USERNAME]', '[PASSWORD]'), headers=headers)
print(r.status_code)
print(r.text)
#print(r.content)

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

0 vote

Hi Pat,

Please make sure your domain is set to https://instance.atlassian.net/wiki and not just https://instance.atlassian.net.

If that doesn't help, please clarify a little on what error you are receiving, and which call you are using.

I hope this helps.

Cheers,

Clarissa.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

1,027 views 23 13
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you