Confluence REST API not working

lykaibernardo September 19, 2017

Hello,

We are having issue when accessing our Confluence rest api via curl command using basic authentication. The rest api in Confluence are correctly configured but when accessing the rest api, we are getting 401 UNAUTHORIZED AUTHENTICATION_FAILED. We are using SSO and the user that we are currently using to access the rest api is an internal directory user (user manually created in Confluence).

Below are the curl commands we've tried:

* curl -u <username>:<password> -X GET -H "Content-Type: application/json" "https://<confluenceurl>/wiki/rest/api/content/"

* curl -X GET -H "Content-Type: application/json" -H "Authorization: Basic <token>" "https://<confluenceurl>/wiki/rest/api/content?os_authType=basic"
(https://developer.atlassian.com/docs/atlassian-platform-common-components/rest-api-development/rest-and-os_authtype)

* curl commands mentioned in https://www.smartics.eu/confluence/display/PDAC1/REST+Login+to+Confluence+with+cURL (using cookies and config file)

We are using Confluence v5.8.5 and Confluence http authenticator v2.6.1 (https://github.com/chauth/confluence_http_authenticator). By the way, the confluence api urls are accessible via browser and we are getting the json result.

Is anyone encountered the same issue and know the resolution? Is this a bug in Confluence with using http authenticator?

1 answer

0 votes
Prem Sree April 18, 2018

Same issue encountered. Any fix available now?

 

Many thanks,

Prem Sree

Pavel Potcheptsov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2018

Provide output with curl -vvv option.

Prem Sree April 18, 2018

sending using POSTMAN.

 

Status as "200 ok" but not authenticating  as expected, even accepts incorrect credentials.

URL used: http://servername.domain.com:8080/confluence/rest/plugins/1.0/

Response Header:

Age →0

Connection →keep-alive

Content-Length →0

Date →Wed, 18 Apr 2018 12:21:53 GMT

Server →Apache-Coyote/1.1

Via →1.1 localhost.localdomain

X-ASEN →SEN-XXXXX

 

Thanks,

Supreet Yadav July 6, 2020

We are also getting 

HTTP/1.1 401 Unauthorized while using rest api to get/delete the pages in confluence.

Any fox for this ?

curl -vvv -u uname: pwd-X GET 'https://domain.com/rest/api/content/49721292'

HTTP/1.1 401 Unauthorized

< Server: AppleHttpServer/e81851ddfbfa

< Date: Mon, 06 Jul 2020 15:12:32 GMT

< Content-Type: text/html;charset=utf-8

< Content-Length: 1116

< Connection: keep-alive

< Content-Language: en

Thanks,

Supreet

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events