JavaScript Load Error when using REST API

Mylene Haus
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!
August 9, 2024

Hi all! I'm running into an issue when attempting to fetch data from a Confluence page via a cURL command using the REST API. I've created an app in the Atlassian developer console to do so and have enabled OAuth 2.0 (3LO) for it.

I can successfully follow the steps to retrieve the user permission -> response code -> access token -> cloud ID for my project. However, I run into an issue at the very end when trying to receive the contents of a given Confluence page link. My cURL command:

 

curl --request GET \ 
--url  <URL TO THE CONFLUENCE PAGE> \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'

Running this command results in a 200 OK response, but the response body itself contains an error message rather than the Confluence page data:

Atlassian
JavaScript load error
We tried to load scripts but something went wrong.
Please make sure that your network settings allow you to download scripts from the following domain:
https://id-frontend.prod-east.frontend.public.atl-paas.net

Am I misunderstanding a step in the REST API documentation itself? Or am I on the right track, but need to somehow resolve the JavaScript load error in order to be able to fetch the page data? Thanks so much!!

1 answer

0 votes
David Bakkers
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.
August 11, 2024

Hello @Mylene Haus 

You have obfuscated the --url value in your supplied cURL request, so there's no way to know what API endpoint you are attempting to connect to, so there is no way to validate the problem.

What is the URL of the endpoint that you are connecting to?

Mylene Haus
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!
August 15, 2024

Hi David, thanks for the reply! 

The --url value I'm using is a link to a page on my organization's Confluence, so the link is formatted like:

https://<ORGANIZATION NAME>.atlassian.net/wiki/spaces/<SPACE NAME>/pages/<ID>/<PAGE NAME>/ 

David Bakkers
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.
August 20, 2024

Unfortunately, you have again obfuscated all the useful information in the URL path with placeholder text, so I am still not able to determine if it is or isn't valid.

However I can see that the path is fundamentally incorrect, as:

1. It does not contain the required wiki/rest/api/ in the path for the v1 endpoints.

2. It attempts to reference the space by its NAME and the API always references spaces by their ID or KEY.

3. It ends with <PAGE NAME> and there are no endpoints that end with names of pages

4. The reference to a <PAGE NAME> comes directly after a reference to a page <ID>, which is essentially a duplication, since the page's ID is an abstracted of its name, and no endpoint would ever do that

I get a feeling you are somehow trying to connect with an actual wiki page in your Confluence instance, as if that page itself had some sort of 'REST API' capability.

If that is the case, you've not grasped the nature of Confluence's REST APIs and how to access them, so I can only suggest you re-visit the documentation and look more closely at the examples provided.

Suggest an answer

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

Atlassian Community Events