Is there any Confluence REST API which authenticates a confluence

Aniket September 28, 2017

Working closely on Jira & Confluence REST API's 
Jira API to authenticate user :  https://tickets.ingramcontent.com/rest/auth/1/session

body

{
"username": "someUserName",
"password": "somePassword"
}


So I've found the respective REST API for Jira for authenticating a jira_user...

But im unable to find a suitable REST API CONFLUENCE which authenticates a conf_user...& need such that satisfies the same goal such as Jira REST API

Is there such Confluence REST API which authenticates a conf_user?


If Not....how do I find out a work-around to authenticate a conf_user ?

Thanks in advance.

1 answer

1 vote
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2017

Hi Aniket

You'll need to authenticate prior to the call; you can see examples in this article:

Confluence REST API Examples

See the text before the call:

curl -u admin:admin

Let us know if you have any questions.

Kind Regards,
Shannon

Aniket October 5, 2017

apologies for late reply...kept this issue on stand by n moved on due to other priorities.


surely will work on your solution & post my response once i go back n get that done. haven't got a chance to do so lately.

thanks for your reply @Shannon S

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2017

Thanks, Aniket for the update!

Let us know if you have any trouble or questions.

Kind Regards,
Shannon

Aniket October 10, 2017

Hi Shannon.

My motive just was to validate the confluence user...which I am able to do very easily in the case of Jira...since jira has its own authenticateUser ReST API : Jira Login

But there isn't any such dedicated ReST API for confluence login,
or to authenticate confluence user at the moment.

what u mentioned above worked for me. :)

curl -u admin:admin

example :

curl -u user123@gmail.com:password123 -X GET -H "Content-Type: application/json" https://yourDomainName/rest/api/user?username=user123@gmail.com

writing down my small detailed findings for others who come across this same scenario.


The above curl command when executed internally first validates the credentials mentioned, which in turn if are valid then invokes the confluence url mentioned in the later part of the curl command.

therefore, we get a

"200 OK" response on success & valid credentials.

"401 unauthorized" response is for INVALID credentials, i.e invalid userName or password provided.

"403 forbidden" i.e the API invoked was prompted for a CAPTCHA CHALLENGE. therefore the api invocation & curl command execution failed and the response is 403...here the credentials are valid but due to captcha challenge it gave a 403 error. this might be handled of admin level for those user to disable the captcha.

the Confluence ReST API used is simple : get user

https://docs.atlassian.com/confluence/REST/latest-server/#user-getUser 

Initially I was really struggling...thought why couldn't confluence just expose a API for login/authenticateUser ... simply would have helped people n saved time. Anyways this does my intended work.

I actually saw that page & overlooked it...at that time was just hunting for some dedicated API for this purpose. anyways..

Thanks for the Pointer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events