Listing Public Workspaces via REST

Hi,
Is there a way to list all the public workspaces for an organisation via the REST API?

Or, alternately, to list all the workspaces the current user has access to either by ownership, invitiation, or because they are public. I can list all the workspaces the user owns or is invited to but I can only get the public workspaces if I know the ID ahead of time.

Hi @Will_Wilson,

You can access the workspaces for the user that has authorized the bearer token with REST get a list of the user’s workspaces:

You can then filterBy organizationId and isPublic by using url encoded query params to return public workspaces for the specified organization.

Example filter:
{{API_path}}/v3/users/me/workspaces?filterBy=organizationId eq "{{orgId}}" and isPublic eq true

Example curl:

curl --location --request GET 'https://api.apps.us.bluescape.com/v3/users/me/workspaces?filterBy=organizationId%20eq%20%22wOETxsWt3SAmuyUQbbLy%22%20and%20isPublic%20eq%20true' \
--header 'Authorization: Bearer <userBearerToken>'

Sample Response:

{
	"prev": "8G0...snip...RFv",
	"next": "d5I...snip...xEB",
	"totalItems": 37,
	"workspaces": [
	{
		"id": "Gc3g0a4q_Jbjs0IJRu2W",
		"name": "My workspace",
		"description": "This is a beautiful workspace",
		"isPublic": "true",
		"defaultRoleId": "i1F6ZZvj-BGKBqWYX-xr",
		"organizationId": "qYPtaGSZbky-Iy5-4ojd",
		"contentUpdatedAt": "2020-03-17T23:12:05.000Z",
		"ownerId": "z1Hy47sl2U3w7hNWi8Sg",
		"classification": "string",
		"createdAt": "2020-03-17T20:12:05.000Z",
		"updatedAt": "2020-03-17T23:12:05.000Z",
		"archivedAt": "2020-03-17T23:12:05.000Z",
		"storageUsed": 0,
		"pendingReassignmentFrom": "string",
		"isFavorite": true
	}]
}

Thanks but this isn’t quite what I’m asking.

Basically I’m looking for a way to get a list of all workspaces a user has access to. This means everything from /users/me/workspaces, but also other public workspaces that the user is not explicitly added to.

For example if there are three workspaces (A, B, and C), and two users (1, and 2).

  • User 1 owns workspace A
  • User 2 owns workspace B and user 1 has been invited to join
  • User 2 owns workspace C, no one has been invited to join the workspace but it is a public workspace

In the UI user 1 has access to all three of these workspaces, and, if they know the ID, they can access all three workspaces through the API – /workspaces/{workspaceID} will return any of these workspaces. However I can’t find any way to list workspaces like workspace C. /users/me/workspaces only includes workspace A and B.

I hope that makes sense.

Alternately, and honestly probably preferably, is there some set of permissions that we could give a user that would allow them to list other users workspaces? I can see API calls for this /users/{userID}/workspaces, but, even with admin access, these return permission errors.

1 Like

Hello @Will_Wilson,

You can include the public workspaces the user has access to by using the associatedWorkspaces eq false filter on the /users/me/workspaces route.

For example:

https://api.apps.us.bluescape.com/v3/users/me/workspaces?includeCount=true&filterBy=associatedWorkspaces eq false&orderBy=createdAt desc

You can also combine multiple filters to make more advanced queries. For example, if the user has access to multiple organizations we can use the organizationId filter for a particular organization in addition to the associatedWorkspaces filter:

https://api.apps.us.bluescape.com/v3/users/me/workspaces?includeCount=true&filterBy=organizationId eq "<ORGANIZATION-ID>" and associatedWorkspaces eq false&orderBy=createdAt desc

Make sure to update the query with the organization id you are interested in.

Let me know if you encounter any further issues.

-Antti

1 Like

Thanks Antti. That’s what I was looking for.

2 Likes

Thank you, @Antti2000 ! @Will_Wilson, please let us know if you have any other questions.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.