I am able to get Conflunce link at Jira issue, but cannot read the content of Confluence page:
def issue = ComponentAccessor.getIssueManager().getIssueObject("GR-5")
log.info('Start')
def rlm = ComponentAccessor.getComponent(RemoteIssueLinkManager)
def links = rlm.getRemoteIssueLinksForIssue(issue)
def onlyConfluenceLinks = links.findAll {
if(it.applicationType == RemoteIssueLink.APPLICATION_TYPE_CONFLUENCE){
log.info(it.applicationType) // Output: com.atlassian.confluence
log.info(it.getSummary()) // Output:
log.info(it.getTitle()) // Output: Page
log.info(it.getUrl()) // Output: https://confluence.com/pages/viewpage.action?pageId=6652581
log.info(it.getSummary()) // Output:
}
}
My Conflunce page looks like that:
I need to get all LO issues at this page.
How can I get content of Confluence page?
Hi,
you have now RemoteIssueLink (documentation). There is no Confluence page content stored in this class.
But you can extract pageId from url property of RemoteIssueLink and get Confluence page content via REST call:
https://confluence.com/rest/api/content/6652581?expand=body.storage
This REST call returns JSON with page content. There should be elements with these tags
<ac:parameter ac:name=\"key\">ISSUE-KEY</ac:parameter>
in JSON. You shoul be able to get these issues and filter as you need.
Regard
Josef Pavelec
Hey, @MoroSystems SupportJosef Pavelec! Thank you for your reply! Could you post some code?
I've tried the following code:
def curl = "/usr/bin/curl -u admin:admin https://confluence.oop.ru/rest/api/content/6652581?expand=body.storage"
def output = curl.execute().text
But I see the following error:
java.io.IOException: Cannot run program "/usr/bin/curl": CreateProcess error=2, The system cannot find the file specified
at Script6083$_run_closure1.doCall(Script6083.groovy:41)
at Script6083.run(Script6083.groovy:36)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
... 2 more
Is it necessary to have ScriptRunner for Confluence to make REST confluence endpoint?
I have ScriptRunner just for Jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.