Confluence Rest API Error 404

Jannis Koray Köksel October 3, 2019

Hi I want to get the content of a page via rest api call.

I tried all imaginable combinations of user, password and URI.

E.G:

curl -X GET -u <email>:<API Token> "https://domain.atlassian.net/rest/api/content/<ID>?expand=space"

 

curl -X GET -u <email>:<PWD> "https://domain.atlassian.net/rest/api/content/<ID>?expand=space"

 

And I tried multiple page ID's. I got the page id by going to Page Info and then used the ID= ... from URL.

 

I also tried to send a "simple" Https request and added the Authentification to the header. The Http 404 error still occurs. The return header does not contain a Authentication_Failed entry. So I assume that the login has been successful. 

 

 

1 answer

0 votes
Manuel Bastardo Castellano
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.
October 3, 2019

Hello @Jannis Koray Köksel do you encode your user and pass to base64?? it happened to me that I haven't paid attention to this:

 

Supplying basic auth headers

If you need to you may construct and send basic auth headers yourself. To do this you need to perform the following steps:

  1. Generate an API Token for your Atlassian Account: https://id.atlassian.com/manage/api-tokens
  2. Build a string of the form user@example.com:api_token.
  3. Encode the string using base64.
  4. Supply an Authorization header with content Basic followed by the encoded string. For example, the string user:user encodes to dXNlcjp1c2Vy in base64, so you would make the request as follows:
curl -D- \
   -X GET \
   -H "Authorization: Basic dXNlcjp1c2Vy" \
   -H "Content-Type: application/json" \
   "https://your-domain.atlassian.net/wiki/rest/api/space"

the postman integrations its a great start also

hope it helps 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events