What does "503 - Service Unavailable" mean?

Kristian June 25, 2021

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 accepted

2 votes
Answer accepted
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 2021

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

1 vote
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2021

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

Kristian June 28, 2021

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?

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2021

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

Sam Lee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2021

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

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 30, 2021

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

Kristian June 30, 2021

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.

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 30, 2021

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

test16 fortinet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 30, 2021

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

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2021

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

Louis Chan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 7, 2021

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
Atlassian Team members are employees working across the company in a wide variety of roles.
July 7, 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 likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events