How to find which are the spaces used in a Jira project.

Bibek Behera
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 3, 2024

 

Is there a way to find the linked spaces to a particular jira project . Use case is to identify if any spaces need to be migrated alongside side few selected projects from one site to another. For the time being, I am running through the issues individually so see the (mentioned in confluence page )section in the jira ticket. 

 

Thanks

 

3 answers

0 votes
ADM Michael Blake
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2024

if you have ScriptRunner for Jira installed in data center, you can run:

 issueFunction in linkedIssuesOfRemote(host, "<confluence url") and key= <issue key>

this JQL will return the issue if the "confluence url" is found in any fields for the specified key.

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2024

Ok, so I found some endpoints, but ugh, yeah, it's unofficial and undocumented, and WORSE STILL, it's GraphQL (nooooooo!)

⚠️ Use of Unofficial and Undocumented APIs is NOT RECOMMENDED for any production tasks or Automations. This information is strictly for informational, and possible one-time uses/runs/migrations etc. because they are inherently fragile and may break if Atlassian changes the API.

(On the other hand, it’ll probably be fine.)

But basically, here's the endpoint:

https://YOURSITE.atlassian.net/rest/gira/1/?operation=issueViewRemoteDataQuery

And the query (god I hate GraphQL):

{"query":"
    query issueViewRemoteDataQuery($issueKey: String\u0021) {
        bentoViewIssue_remote_data: viewIssue(issueKey: $issueKey) {
    issueId
    remoteLinks {
      isLinkingEnabled
      confluencePages {
            linkedPages {
    pageCount
    pages {
        ... on ConfluencePage {
            id
            globalId
            href
            title
            type
            lastUpdatedContext {
    user {
        key
        accountId
        emailAddress
        avatarUrl
        displayName
        active
    }
            }
        }
        ... on FailedRemoteLink {
            id
            error
            link {
                id
                globalId
                href
            }
            repairLink { href }
        }
    }
            }
            mentionedPages {
    pageCount
   
    pages {
        ... on ConfluencePage {
            id
            globalId
            href
            title
            type
            lastUpdatedContext {
               
    user {
        key
        accountId
        emailAddress
        avatarUrl
        displayName
        active
    }
            }
        }
        ... on FailedRemoteLink {
            id
            error
            link {
                id
                globalId
                href
            }
            repairLink { href }
        }
    }
            }
        }       
    webLinks(allowThirdParties: true, orderBy: \\"-id\\") {
        linkCount
        links {
            id
            href
            linkText
            iconUrl
            summary
            resolved
            relationship
            applicationName
            applicationType
        }
    }       
    remoteLinkedIssues {
        preview {
           
    id
    issueId
    globalId
    href
    applicationType
    applicationName
    relationship
    title
        }
        details {   
    ... on AssociatedIssueWrapper {
        associatedIssue {         
    issueId
    issueKey {
        stringValue
    }
    summary {
        textValue
    }
    status {
        statusCategoryId
        name
        statusId
    }
    priority {
        iconUrl
        name
    }
    issueType {
        iconUrl
        name
    }
    assignee {
        userValue
        {
            displayName
            avatarUrl
        }
    }
  isResolved
        }
    }
    ... on FailedRemoteIssue {
        error
        repairLink { href }
    }
        }
    }
    }
        }
    }
","variables":{"issueKey":"BUG-1"}}

ANYWAYS, that is the query that produced the data for this in the Jira view of BUG-1:

Screenshot 2024-11-07 at 12.18.46 PM.png

So THEN, if you run this command (and miraculously it DOES work with an API Token) across all the issues in your project (sorry), you should be able to get a listing of all pages that mention issues in the project.

The only header I had to include in my curl test was this:

content-type: application/json

Anyways, so yeah, it's technically possible. Will just require making that call for all the issues in your project.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2024

Here's the "collapsed" version of the GraphQL call, with all the other bits I used in curl:

curl 'https://YOURHOST.atlassian.net/rest/gira/1/?operation=issueViewRemoteDataQuery' \
-s -n \
-H 'content-type: application/json' \
--data-raw $'{"query":"\\n query issueViewRemoteDataQuery($issueKey: String\u0021) {\\n bentoViewIssue_remote_data: viewIssue(issueKey: $issueKey) {\\n \\n issueId\\n remoteLinks {\\n isLinkingEnabled\\n confluencePages {\\n linkedPages {\\n \\n pageCount\\n \\n pages {\\n ... on ConfluencePage {\\n id\\n globalId\\n href\\n title\\n type\\n lastUpdatedContext {\\n \\n user {\\n key\\n accountId\\n emailAddress\\n avatarUrl\\n displayName\\n active\\n }\\n\\n }\\n }\\n ... on FailedRemoteLink {\\n id\\n error\\n link {\\n id\\n globalId\\n href\\n }\\n repairLink { href }\\n }\\n }\\n\\n\\n }\\n mentionedPages {\\n \\n pageCount\\n \\n pages {\\n ... on ConfluencePage {\\n id\\n globalId\\n href\\n title\\n type\\n lastUpdatedContext {\\n \\n user {\\n key\\n accountId\\n emailAddress\\n avatarUrl\\n displayName\\n active\\n }\\n\\n }\\n }\\n ... on FailedRemoteLink {\\n id\\n error\\n link {\\n id\\n globalId\\n href\\n }\\n repairLink { href }\\n }\\n }\\n\\n\\n }\\n }\\n \\n webLinks(allowThirdParties: true, orderBy: \\"-id\\") {\\n linkCount\\n links {\\n id\\n href\\n linkText\\n iconUrl\\n summary\\n resolved\\n relationship\\n applicationName\\n applicationType\\n }\\n }\\n\\n \\n remoteLinkedIssues {\\n preview {\\n \\n id\\n issueId\\n globalId\\n href\\n applicationType\\n applicationName\\n relationship\\n title\\n\\n }\\n details {\\n \\n ... on AssociatedIssueWrapper {\\n associatedIssue {\\n \\n issueId\\n issueKey {\\n stringValue\\n }\\n summary {\\n textValue\\n }\\n status {\\n statusCategoryId\\n name\\n statusId\\n }\\n priority {\\n iconUrl\\n name\\n }\\n issueType {\\n iconUrl\\n name\\n }\\n assignee {\\n userValue\\n {\\n displayName\\n avatarUrl\\n }\\n }\\n isResolved\\n\\n }\\n }\\n ... on FailedRemoteIssue {\\n error\\n repairLink { href }\\n }\\n\\n }\\n }\\n\\n }\\n\\n }\\n }\\n","variables":{"issueKey":"BUG-1"}}'

Aside from the --data-raw bit, the other flags for curl are:

-s = silent mode, so it skips display a little progress bar while making the connection

-n = netrc file. This specifies that curl will load in the authentication details (your email address + API token) from a .netrc file stored in your home directory. It's a super-handy way to keep the auth info for your host(s) in a file and avoid having to include them on the command-line with the --user or -u mode or having to include an Authorization header and base64 encoding stuff, which ugh.

0 votes
Fadoua
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 3, 2024

@Bibek Behera

Welcome to the Atlassian Community!

On the left frame of your project you should be able to see if it is linked to a Confluence space.

Let me know if you have any more questions.

Best,

Fadoua

Screenshot 2024-11-03 at 12.14.09.png

 

Bibek Behera
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 5, 2024

Thank @Fadoua ,

May be I didn't explain the issue correctly. Linking the space/page to a project is a different thing. I am wondering how to get the list of spaces/pages linked to a project in terms to linked in jira tickets. for example

ABC-1 is linked to a page in space A

ABC-2 is linked to a page in space B 

In the same way, I want to be able to list all the space that could be associated to Project ABC.

-Bibek

Fadoua
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2024

@Bibek Behera 

Ah I see. I don’t think it can be done even with a JQL.

If you had a custom field for Confluence links it would have helped. I don’t think you can do it without the use of a custom field.

Best,

Fadoua

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events