Programatic Add to "Space Shortcuts" in Confluence Cloud
Asked by Pete Dunham:

I have been investigating a way to programmatically add to**Space Shortcuts**(see attached screenshot) as part of our space templating process. Ideally, it would this would be an available REST API to make this call but I haven't found one that exists.

![Screen Shot 2020-01-02 at 1.58.54 PM.png](/t5/image/serverpage/image-id/77597i39C0286EC20292CA/image-dimensions/284x102?v=v2 "Screen Shot 2020-01-02 at 1.58.54 PM.png")

I reaching out to the community for any ideas for a work-around that would allow for Automation.

I found the below in another post, but it is for Confluence Server

Please look "Programmatically creating a shortcut link" here: <https://developer.atlassian.com/confdev/tutorials/adding-space-shortcut-links>

I've tried Selenium but it does not play nice with Confluence.

Any other hidden gem work arounds or undocumented calls to make this programmatic?

Any help is greatly appreciated!


Answers:
author: Diego
body: Hey there, [@Pete Dunham](/t5/user/viewprofilepage/user-id/2016943) !

Looking at your request, I believe that I can give you some guidance on how to get started with that. The first thing that I wanted to clarify is that we do not have a REST method to work with these shortcuts. We can try to achieve your desired results with JavaScript, for example.

The first thing we want to look into is the network activity that happens when we add the Space Shortcut. Here is a GIF of what I did:
> ![NetworkActivity.gif](https://community.atlassian.com/t5/image/serverpage/image-id/78238i5C3F7C319121694E/image-dimensions/538x284?v=v2 "NetworkActivity.gif")

So, what is happening is:

We are looking at the network activity, specifically of the moment that we click Add Shortcut and Save buttons

We need to look into the Batch that shows up right after clicking Add Shortcut and the CGRAPHQL that shows when we click Save.

The Batch contains the info that we need to later use in variables in the CGRAPHQL. You will notice that the CGRAPHQL does not contain values, but references. Those are inside the Batch.

Here, screenshots of what you should see inside them:

> Batch:
>
> ![Anota??o 2020-01-08 150438.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/78241i05EEACD9B82EE7A0/image-dimensions/442x163?v=v2 "Anota??o 2020-01-08 150438.jpg")
>
> CGRAPHQL![Anota??o 2020-01-08 150450.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/78240i4BAE4B1E897B1AEB/image-size/large?v=v2&px=999 "Anota??o 2020-01-08 150450.jpg")

For us to get the values inside those, you can++*Right-Click \> Copy \> Copy as fetch.*++ This allows us to work with them in a text editor and JavaScript to apply whatever method we might need.

++*All this happens while we are already authenticated in the browser. So the authentication is also something we need to take care of.*++

If you need more insight than that, you might need to reach out to our Developer Community, as pointed out by [@Shannon S](/t5/user/viewprofilepage/user-id/510046)! Here is the link to our Developer Community:
> * ++**[\[Atlassian Developer\] Developer Community](https://community.developer.atlassian.com/)**++

I hope this sheds some light into your quest, Pete!

comments: author: Pete Dunham
body: [@Diego](/t5/user/viewprofilepage/user-id/1188952) thank you! Somehow I missed this response, I am digesting now.


author: Diego
body: Let us know what you find out!


author: Shannon S
body: Hello Pete,

Thanks for reaching out! I'm not really sure about this myself, but we have a separate community for our Atlassian Developer universe; you might have better luck raising a question there as well.

See [Atlassian Developer Resources](https://developer.atlassian.com/resources) for that site as well as a list of other pages that could help you.

Regards,

Shannon


Tags: atl-adm

confluence-cloud