You need to have an active credential added to add-ons configuration if you don't have it please visit Add and activate Add and activate credentials
0.We created a credential with the key "myCredential" and we activated so we should have following credential listed.
1.Create a new Confluence page (or edit and existing one) and add JavaScript Runner macro with following script inside its body
var spacesWithCredential=JSON.parse(http.get("http://localhost:8090/rest/api/space","myCredential")); var spacesWithoutCredential=JSON.parse(http.get("http://localhost:8090/rest/api/space")); out.element("h3","Space count:"+spacesWithCredential.size); out.element("h3","Space count:"+spacesWithoutCredential.size);