Hi there,
Jira Service Management 5.11.3
i´m trying to provide a "customer request" on customers portal "Request access to Confluence space"
Therefore it would be handy to somehow list available Confluence Spaces, make them available as picker field (multi or single) in that request form.
I managed to find the REST endpoint of our Confluence DC instance
https:://%my-confluence-url%/rest/spacedirectory/1/search?type=global
Available apps:
Help would be appreciated.
Thank you
Eric
Hello Eric!
I hope you are having a great day! My name is Hyrum, and I am a Power Scripts support engineer with Appfire. I came up with a solution and am posting an example script below. During testing, I tried out the /spacedirectory endpoint, but the data returned is in XML. Unfortunately, this is not supported by the SIL language. However, I was able to use the /space endpoint and it works great! See this Atlassian documentation for complete details on /space REST method:
https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#space-spaces
The SIL script below uses the httpGet() routine to get the JSON data from the /space endpoint in Confluence. Then, the names of all the Spaces are printed to "updateoptions.txt" so that it can be used by admUpdateCustomFieldOptions().
struct Results {
string name;
number id;
string type;
string key;
}
struct ConfluenceSpacesData {
Results [] results;
}
HttpRequest request;
request.headers += httpCreateHeader("Content-Type", "application/json");
request.headers += httpBasicAuthHeader("admin", "admin");
ConfluenceSpacesData confluenceSpacesData = httpGet("http://localhost:8090/rest/api/space", request);
string spaces;
for (Results result in confluenceSpacesData.results) {
spaces += result.name + " (" + key + ")\n";
}
printInFile("updateoptions.txt", spaces);
admUpdateCustomFieldOptions("selectList", "updateoptions.txt", "", "", "", {"DEMO"}, {}, false, false, false);
Here is the documentation for admUpdateCustomFieldOptions().
It has been my experience that any script that uses REST or updates custom field options can be quite fiddly and not easy to use. For further assistance, please create a support request with us, and we will help you implement your use case to your exact specifications. Click on the link below:
Regards,
Hyrum
Thanks for stepping up, @Hyrum Steffensen _Appfire_! - I see @Eric has created a support request (https://appfire.atlassian.net/browse/SUPPORT-164937).
We'll be happy to continue helping on this matter.
Best regards,
Pablo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.