Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

What does "503 - Service Unavailable" mean? Edited

I am making an api call to the confluence cloud api to get the content of page by its id. I had no problem getting this data before yesterday. Now I am getting a response of ->

503 - Service Unavailable and when I click on the 503 error in the dev chrome console I see this:

!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="description" content="Encountered a 401 - Unauthorized error while loading this page.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Atlassian Cloud Notifications - Page access unauthorized</title>
    <link rel="stylesheet" href="/_edge/resources/aui-prototyping.css">
    <style>
        body {
            background: #fff;
        }
        main {
            margin: auto;
            padding-top: 120px;
            text-align: center;
        }
        .suggestion {
            font-size: 16px;
            color: rgb(94, 108, 132);
            width: 350px;
            padding-top: 20px;
            margin: auto;
        }
    </style>
</head>
<body>
<main>
    <img
        src="/_edge/resources/images/error-generic.svg"
        alt="error icon"
        width="120"
    />
    <h2>
        There was a problem accessing this content
    </h2>
    <p class="suggestion">
        Encountered a 401 - Unauthorized error while loading this page.
    </p>
</main>
</body>
</html>

I am able to authorize with my account to get an api token and the bearer token is part of my request, yet it still says I am unauthorized. Has anyone seen this before?

Thanks!

2 answers

1 vote

Hello Kristian,

Thanks for including the steps you're taking and the information around your token. From the looks of it, I don't believe the issue to your a token or an auth issue. This looks like you're not actually hitting an endpoint but instead a Confluence page.

  • Could you please let us know which endpoint you're attempting to access?
  • Is the endpoint you're accessing available via a cURL call? (Using the REST API )

Regards,
Stephen Sifers

Hi Stephen, thanks for the response!

I am just trying to make a direct call to the confluence cloud REST API to get the content of my cloud site.

So my request looks like this:

GET https://brikit-cloud-dev.atlassian.net/wiki/rest/api/content
> Host: brikit-cloud-dev.atlassian.net
> user-agent: insomnia/2021.3.0
> accept: application/json
> authorization: Bearer {my jwt}

We are utilizing this REST api call in our application in production and its been working great up until last Thursday when  we noticed it started responding with 503 - Service Unavailable.

I am wondering and trying to figure out what has changed.

I know my token is valid because I can make this request and get a 200 back:

GET https://api.atlassian.com/oauth/token/accessible-resources

> accept: application/json
> authorization: Bearer {my jwt}

I am utilizing 0Auth2 to authorize and get an api token to make requests.

However for some reason, I can no longer get a successful response back from calling the REST Api directly. I am making the call from Insomnia (a rest api client app).

So I believe it's not an issue with my token. We did also make a change to our account and went from a standard cloud account down to a free cloud account site. Perhaps this might affect the REST API permissions?

Hello Kristian,

Thanks for confirming the endpoint you're using and showing how you're authenticating. I do see your Confluence site was upgraded to a standard plan, I mention this as I was going to point out that you might have been hitting an issue with permissions on your Free plan site. (Or your token expired exactly after 7 days as expected).

If you started your Confluence Trial Friday (18th) and it stopped working on Thursday (24th), you might have seen your site switch from an evaluator plan to a free plan thus limiting your API access as permissions might have been adjusted.

More information on permissions may be found at What are Confluence Cloud permissions and restrictions? 

Permissions and restrictions aren’t customizable on the Free plan

Something else to be aware of, your token will only last seven(7) days from issue and will then expire. Please attempt to re-issue your token and attempt the API endpoint call again.

All access tokens expire after seven days. Once the access token is revoked or has expired, the Confluence gadget will only have access to publicly available Confluence data.

Source: Manage OAuth access tokens 

Regards,
Stephen Sifers

Hi @Stephen Sifers :

We encountered the same issue as @Kristian since June, 24th.

We have verified the permissions and scopes and we have upgraded from free to standard plan.

However we still get the same 503 response.

 

Please advise.

Sam

Hello,

OAuth tokens will only last 7 days from issue and will need to be re-issued when they expire.

Could you please revoke and re-issue your OAuth tokens and attempt your API call again?

Regards,
Stephen Sifers

Hi Stephen,

I have implemented the refresh token that will issue a new token when it expires. This was working up until last Thursday (June 24th). Since then, I no longer seem to be able to get a successful response from calling the api directly using any valid token (https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-api-content-get). I tried revoking my token in my account settings and re-authenticating to get a new token, but still no success with using the new tokens. I still get the '503 - Service Unavailable' error back saying 'unauthorized' even though I am using a valid token from a successful oAuth2 authorization.

Screen Shot 2021-06-30 at 7.27.51 AM.png

 

I can however get the content data successfully using this request method: https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/#3--make-calls-to-the-api-using-the-access-token.

Hello,

Thanks for re-issuing your token and testing again. This seems like a permissions issue as you're able to validate your token. 

Could attempt to make a call against the following endpoint and report back its results:
POST /wiki/rest/api/content/{id}/permission/check 

I do see a change as of the 24th for the Confluence Cloud rest API (Changelog | 24 June 2021 ). This update looks to have only introduced a Space permission endpoint.

Once we verify the results of the endpoint above I'll get a support case opened for this. @Sam Lee Same for you as well, let me know the results and I can open a case on your behalf.

Regards,
Stephen Sifers

Hello @Stephen Sifers :

Here is what I got:

I still got 503 error when trying with content permission check:

Screenshot from 2021-06-30 15-01-18.png

My token has content permission:

Screenshot from 2021-06-30 15-01-51.png

 

Thanks 

Sam

Hello,

I apologize for the delay here. I've gone ahead and created support requests for both of you, you should both receive emails shortly with the details for the support requests.

If you have any further issues with this or need help escalating please reach back out on this thread.

Regards,
Stephen Sifers

Hello @Stephen Sifers

    Adding another example that I encountered the same issue also - even with a brand new token created by OAuth, I am getting 401 Unauthorized error for newly created token, and before when I tested on an existing token, getting a 503 Service Unavailable error.

    Please let me know if there is any information I can provide to help debugging this issue.

Thanks,
Louis

devpartisan Atlassian Team Jul 07, 2021

Hi all,

I think this same issue was also posted on the Atlassian developer community:

https://community.developer.atlassian.com/t/getting-503-error-while-calling-confluence-api/49429

In summary, if you aren't using the API URL pattern described in the 3LO documentation, then you will get a 503 error. The correct pattern for OAuth tokens is: https://api.atlassian.com/ex/confluence/{cloudid}/{api}

The 503 itself is an incorrect error. It should be a 401 (as happens for newly created tokens). And I have come to understand this is a breaking change from sometime in the past but I'm not able to explain when or why it happened. As such, this is an answer but not an explanation so please continue to pursue support options if you need to understand how it happened.

Like Caterina Curti _Kate_ likes this

Hi all,


Please check the message I've just posted in the Atlassian developer community about
what happened and what is the correct way of requesting the API endpoints in the future for "OAuth 2.0 (3LO) apps":

- https://community.developer.atlassian.com/t/getting-503-error-while-calling-confluence-api/49429/14

 

In case there are any questions or comments, please let me know.

 

Thank you,

Caterina

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
Community showcase
Published in Confluence Cloud

Confluence Bingo Round 3!

That’s right! Grandma’s back at it again, and this time she’s brought all her friends. In honor of Team '21, this Bingo round is dedicated to all things team-related, and the prizes are no exception....

3,157 views 31 22
Read article

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