Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-72627

REST API for inviting single space guest / adding them to a space

    • 1
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Problem Definition

      We're currently rolling-out the the single space guests feature and it would be good to have a way to invite guests through a REST API endpoint, or other automated way.

      Suggested Solution

      Create a REST API endpoint for inviting guests and adding them to a space

      Workaround

      No other workaround at this time besides manually inviting guests through the UI.

          Form Name

            [CONFCLOUD-72627] REST API for inviting single space guest / adding them to a space

            We really MUST have a way to provide access to our Knowledge Base in Confluence for customers by domain name.  If there is a way to embed access in our web app (asp.net) via an API which could grant view-only access this would be good.  We MUST have a way to provide a read-only access to customers without having to manage them individually.  We have about 25 domains which are manageable, but a thousands of users are not manageable.  

            We don't want a work-around or something that is cumbersome to us or to our users.  Providing public access does not work for us.  

            Phil Dorcas added a comment - We really MUST have a way to provide access to our Knowledge Base in Confluence for customers by domain name.  If there is a way to embed access in our web app (asp.net) via an API which could grant view-only access this would be good.  We MUST have a way to provide a read-only access to customers without having to manage them individually.  We have about 25 domains which are manageable, but a thousands of users are not manageable.   We don't want a work-around or something that is cumbersome to us or to our users.  Providing public access does not work for us.  

            Brian Engert added a comment - - edited

            There appears to be a undocumented api that lets you add a user to a space and it works with api tokens.  For inviting a guest you can use the Jira api to add them to the guest group.  for adding them to a space you can use http request below to invite user 12345:12345678901234567890 to the space with the key DEMO.

             

            curl --request POST \
              --url 'https://adminuser%40domain.com:apitoken@site.atlassian.net/cgraphql?q=ResetExCoSpacePermissionsMutation' \
              --data '[
                {
                    "operationName": "ResetExCoSpacePermissionsMutation",
                    "variables": {
                        "accountId": "12345:12345678901234567890",
                        "spaceKey": "DEMO"
                    },
                    "query": "mutation ResetExCoSpacePermissionsMutation($accountId: String!, $spaceKey: String) {\n  resetExCoSpacePermissions(input:

            {accountId: $accountId, spaceKey: $spaceKey}

            ) {\n    status\n    __typename\n  }\n}\n"
                }
            ]'

             

            There is another request that lets you list the guest users on the site and their space associations there is a filter to limit it to users that don't have an assigned space.

            curl --request POST \
              --url 'https://adminuser%40domain.com:apitoken@site.atlassian.net/cgraphql?q=WebItemLocationQuery%3Asystem.help%2Fpages' \
              --data '[
                {
                    "operationName": "GuestDataQuery",
                    "variables": {
                        "includeSpacesAssigned": false,
                        "first": 25,
                        "offset": 0,
                        "spaceIds": [],
                        "spaceAssignmentType": "UNASSIGNED"
                    },
                    "query": "query GuestDataQuery($first: Int, $offset: Int, $name: String, $email: String, $spaceIds: [ID], $spaceAssignmentType: SpaceAssignmentType, $includeSpacesAssigned: Boolean = true, $groupIds: [String]) {\n  externalCollaboratorsByCriteria(\n    first: $first\n    offset: $offset\n    name: $name\n    email: $email\n    spaceIds: $spaceIds\n    spaceAssignmentType: $spaceAssignmentType\n    groupIds: $groupIds\n  ) {\n    count\n    nodes {\n      accountId\n      displayName\n      email\n      profilePicture

            {\n        path\n        __typename\n      }

            \n      spacesAssigned @include(if: $includeSpacesAssigned) {\n        nodes {\n          id\n          key\n          name\n          icon

            {\n            path\n            __typename\n          }

            \n          {}typename\n        }\n{}        _typename\n      }\n      _typename\n    }\n    pageInfo

            {\n      hasNextPage\n      endCursor\n_      _typename\n    }

            \n_    _typename\n  }\n}\n"
                }
            ]'

             

            Brian Engert added a comment - - edited There appears to be a undocumented api that lets you add a user to a space and it works with api tokens.  For inviting a guest you can use the Jira api to add them to the guest group.  for adding them to a space you can use http request below to invite user 12345:12345678901234567890 to the space with the key DEMO.   curl --request POST \   --url 'https:// adminuser%40domain.com : apitoken @ site .atlassian.net/cgraphql?q=ResetExCoSpacePermissionsMutation' \   --data '[     {         "operationName": "ResetExCoSpacePermissionsMutation",         "variables": {             "accountId": " 12345:12345678901234567890 ",             "spaceKey": " DEMO "         },         "query": "mutation ResetExCoSpacePermissionsMutation($accountId: String!, $spaceKey: String) {\n  resetExCoSpacePermissions(input: {accountId: $accountId, spaceKey: $spaceKey} ) {\n    status\n    __typename\n  }\n}\n"     } ]'   There is another request that lets you list the guest users on the site and their space associations there is a filter to limit it to users that don't have an assigned space. curl --request POST \   --url 'https:// adminuser%40domain.com : apitoken @ site .atlassian.net/cgraphql?q=WebItemLocationQuery%3Asystem.help%2Fpages' \   --data '[     {         "operationName": "GuestDataQuery",         "variables": {             "includeSpacesAssigned": false ,             "first": 25,             "offset": 0,             "spaceIds": [],             "spaceAssignmentType": "UNASSIGNED"         },         "query": "query GuestDataQuery($first: Int, $offset: Int, $name: String, $email: String, $spaceIds: [ID] , $spaceAssignmentType: SpaceAssignmentType, $includeSpacesAssigned: Boolean = true, $groupIds: [String] ) {\n  externalCollaboratorsByCriteria(\n    first: $first\n    offset: $offset\n    name: $name\n    email: $email\n    spaceIds: $spaceIds\n    spaceAssignmentType: $spaceAssignmentType\n    groupIds: $groupIds\n  ) {\n    count\n    nodes {\n      accountId\n      displayName\n      email\n      profilePicture {\n        path\n        __typename\n      } \n      spacesAssigned @include(if: $includeSpacesAssigned) {\n        nodes {\n          id\n          key\n          name\n          icon {\n            path\n            __typename\n          } \n           { }typename\n        }\n{ }        _typename\n      }\n      _typename\n    }\n    pageInfo {\n      hasNextPage\n      endCursor\n_      _typename\n    } \n_    _typename\n  }\n}\n"     } ]'  

            No workaround, this is a MUST please... Today, as Atlassian Admin in my company, I have to manage guest in a very time consuming way.

            Florian Royer added a comment - No workaround, this is a MUST please... Today, as Atlassian Admin in my company, I have to manage guest in a very time consuming way.

            This would save me having to type out hundreds if not thousands of emails. This should be a thing.

            Luke Gorham added a comment - This would save me having to type out hundreds if not thousands of emails. This should be a thing.

            This would be super valuable!

            Carl-Michael Strauss added a comment - This would be super valuable!

            This will be very helpful as we need to manage thousands of users.

            Orit Nachshon added a comment - This will be very helpful as we need to manage thousands of users.

              Unassigned Unassigned
              gtworkowski Guilherme T (Inactive)
              Votes:
              44 Vote for this issue
              Watchers:
              28 Start watching this issue

                Created:
                Updated: