External Site to Access Confluence Cloud API via Ajax

Hello,

We have an external site on an external server that we would like to make calls to the Confluence-Cloud REST Api to return JSON data. Can I call our confluence cloud api's via Ajax from our external site? If so, how can I do this?

I have tried multiple ways but I either get CORS errors or possible authentication errors. All I want is to authenticate via anonymous user and (GET) read-only data back. How do I format this Ajax call?

Thanks,

Mike

2 answers

Possibly related, but also no discernible answer: https://answers.atlassian.com/questions/11980450

You can, but you external site would need to do this using JWT https://developer.atlassian.com/static/connect/docs/latest/concepts/authentication.html

For client-side apps running in the browser, the all.js script creates the bridge to between your Confluence Cloud instance and your add-on. It won't work outside of Confluence.

Hey James, could you elaborate on this a bit? Once we have a JWT, how do we utilize that so that our site can pull data? We're missing the steps on what we need to configure within Confluence itself (cloud version) so that the link is made. We've circled through dozens of pages of their documentation, but none of it ties together coherently how to actually do this from A - Z. Thanks for any assistance you can provide!

You need to install a private add-on into Confluence Cloud, just as you would install a 3rd party add-on from the Atlassian Marketplace, but that's the easy bit - based on your description, it would just be an add-on descriptor.

When you install the add-on, it triggers an installation handshake that generates the shared secret. That shared secret needs to be stored so you can create a unique JWT token for each API call.

How you create that JWT token for the API call will depend on what programming language you are using on your server. E.g. this is a toolkit provided by Atlassian for Node.js https://bitbucket.org/atlassian/atlassian-connect-express that has functions to deal with JWT so you don't need to write them from scratch.

This is all covered in the Atlassian Connect documentation https://developer.atlassian.com/static/connect/docs/latest/index.html

Thank you, James. I think it's that initial step of creating an add-on that's been eluding us. I guess we were thinking we're not really building an add-on, just trying to read data out. 

We'll plug away with this extra clarity and see what progress we can make.

No problem. Confluence Cloud's security model does make it more difficult, but the upside is that its more secure smile

BTW you might like to join this mailing list https://groups.google.com/forum/#!forum/atlassian-connect-dev

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

105 views 1 14
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you