How can I call an external rest api from within a generalPage module?

We are using confluence cloud.
We would like to populate a confluence page with data that is retrieved from an external site.

I tried the below

  url: '',
  type: 'GET',
  //data: {name: 'some text', description: 'test'}
  success: function(responseText){
  error: function(xhr, statusText, errorThrown){

but looking at the browser console, i see

GET 404 ()

It simply concatenated the our confluence cloud instance url with the url parameter in the request above.

How should I be getting external data from ?

This one I can answer! Short story: You might not be able to, but it’s not Atlassian’s fault.

  • You don’t need to use AP.request(). You can simply use the feature of your browser – the XMLHttpRequest or jQuery’s wrapper if you have jQuery:
    $.ajax({url: '...'}).success(function(data) { ... }).
  • The REST call will work just fine, but the CORS specification says an iframe can’t reach out to another domain who doesn’t explicitly allow it. So, most probably, the REST answer will be “Request denied”, and that’s because of the browser/, not Atlassian.
  • Since you seem to own https:/, it may be possible to ask them to implement the solution: The solution to CORS is for the target domain to include the HTTP header:
    Access-Control-Allow-Origin: – This way your browser will allow the request to be answered.

I see. Thank You.It seems we are just going to have a scheduled refresh of the main hbs file that shows in the iframe.