Confluence REST API authentication problem

Krystian Balak
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!
June 29, 2021

Hello, I have a problem getting the Confluence Rest API data from an external tool (c# code). I can do this with a browser, but I cannot get data from Postman or my program. Below, I awill describe what I did:

  1. I checked the documentation (https://developer.atlassian.com/server/confluence/confluence-server-rest-api/)
    1. In Authentication header I found that I can’t use my ‘personal access token’ due to the version.
    2. I found page that describes how to use basic authentication. (https://developer.atlassian.com/cloud/confluence/basic-auth-for-rest-apis/).
    3. I created API token on page (https://id.atlassian.com/manage-profile/security/api-tokens).
    4. I built a string based on my email and api token and encoded it to the base64.
    5. I tried to get data in Postman, but I got ‘Status 401 Unauthorized’1e.png
    6. when I opened the same address in browser, I got response but without results.1f.png
    7. when I opened one of the confluence pages and then I repeated request – I got the results in the browser but still nothing in Postman.1g.png
    8. Then I Noticed in History that I need to login to Confluence first before sending the request.1h.png
    9. I found a endpoint used for login (/dologin.action) and I made a post request, but still I couldn’t login.1i.png
    10. I got the same result when I opened the page in a browser (I am sure that I used a correct credentials) – it seems like I don’t have a Confluence account – but a Microsoft account, as we can see in the history [1. 8)].
  2. The second way that I tried was to use OAuth 2.0 (3LO) apps
    1. I created app in (https://developer.atlassian.com/console/myapps/).
    2. I configured OAuth 2.0 in Authorization section.
    3. I added Permissions.
    4. When I tried to open authorization URL, I got message ‘Something went wrong’.2d.png

My questions:

  1. What I do wrong? What possibilities do I have to get data from Confluence rest API?
  2. Should I login to Microsoft Online and then I will get cookies that I can use in my requests to download data?
  3. Will I get data from the rest API when I have local confluence account?

Important information:

  1. Atlassian Confluence 7.4.8
  2. I don’t have Confluence Administrator rights

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events