JavaScript Load Error when using REST API
Asked by Mylene Haus:

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!!  


Answers:
author: David Bakkers
body: Hello [@Mylene Haus](/t5/user/viewprofilepage/user-id/5564670)

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?

comments: author: Mylene Haus
body: 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\>/


author: David Bakkers
body: 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](https://developer.atlassian.com/cloud/confluence/rest/v1/intro/#about).

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.


Tags: app

cloud

confluence-cloud

curl

oauth

rest-api