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

API REST on Confluence SERVER (not Cloud) : getting 401 authorization failed Edited

Hi,

Often, I succed to find a solution to my problem via forums and internet. But, this time I'm stuck and I decided to share my problem because I think it could be useful for others confluence developers.

Environnement :

  • Confluence SERVER (not Cloud)
  • Presently, it's the first use of REST API for me

 

What I want to do ? Create a page from a website via a Restful call.

A POST call to "https://confluence.etsmtl.ca/rest/api/content/"

I installed the REST API Browser on Confluence Server.

I succed to call and create the page I wanted (see below).

REST API Browser.JPG

Then, I tried to use the same call from a different url (not from the same url of the confluence site). For that, I used ARC (Google Chrome pluggin).

When I send the call, I received a 401 - Unauthorized .

  • Basic Authentication Failure - Reason : AUTHENTICATED_FAILED
  • The request has not been applied because it lacks valid authentication credentials for the target resource.

 

401.JPG

What is my code ?

POST /rest/api/content/ HTTP/1.1
HOST: confluence.etsmtl.ca
content-type: application/json
status: current
authorization: Basic XXXXXXXXXXXXXXXX
content-length: 200

{"type":"page","title":"----P1.new page(GUS vers Confluence)","space":{"key":"~romain.lafond@etsmtl.ca"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}

where XXXXX is myusername:mypassword in base64.

My username is the username in my profil (not my email).

Each time, I sent the request, I received 401 AUTHORIZATION FAILED, after 3 times, it became a 401 AUTHORIZATION  DENIED.

In Confluence, on my user profile (sorry it's in French), my current number of connection failures is increasing each time i try. So, I understand, my username is correct.

Se connecter

  • Dernière connexion: sept. 19, 2019 09:34
  • Dernier échec de connexion: sept. 19, 2019 09:33
  • Nombre total d'échecs de connexion: 47
  • Nombre actuel d'échecs de connexion: 3

 

Next ? I red that basic authentification is deprecated but only for Cloud Confluence.

 

So, i'm stuck, I don't know which lead i could follow, If you have an idea to share, don't hesitate :-)

Thanks a lot to read me and if you have an idea, you are my hero !

 

Romain L.

0 answers

Suggest an answer

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

462 views 24 9
Join discussion

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