Get the list of your workspaces

Objective: get a list of all Workspaces you can access. You do not need to know your user_id to perform this operation. From this list you can retrieve the workspace IDs to use on other APIs that require you to have the Workspace ID.

All API endpoints share the same base URL:

https://api.apps.us.bluescape.com

After you receive the authentication token, you can get a list of all the workspaces you can access.

Endpoint /v1/users/me/workspaces
Method GET
Comments You do not need to know the client_id to get this list of workspaces of the user.

Code sample

See below code samples in Python and Node.js.

Python Code (python 3.5+)

import requests
import pprint

'''
Required modules:
    requests 2.22.0
'''

# Get the list of workspaces the user account associates to the Authentication Token can access

token = 'SET_YOUR_TOKEN_HERE'

if __name__ == "__main__":
   portal = "https://api.apps.us.bluescape.com"

   # Get all the images from a workspace

   API_endpoint = '/v1/users/me/workspaces'

   the_request = requests.get(
       portal + API_endpoint,
       headers={"Authorization": "Bearer " + token}
   )

  # format answer to json
   json_response = the_request.json()
   # By default we get the first 25 workspaces

  # added to format display of json output
   pprint.pprint(json_response)

Node.js Javascript

var axios = require('axios');

/*

How to run:
node this_script_name.js

Requires "axios" module (0.19.0), run:
npm install axios

website: https://github.com/axios/axios

*/

const token = 'SET_YOUR_TOKEN_HERE';
const portal = 'https://api.apps.us.bluescape.com';
const api_version = 'v1';
const api_endpoint = '/users/me/workspaces';

request_values = {
    method: 'GET',
    url: portal + '/' +api_version + api_endpoint,
    headers : {
        'Authorization': "Bearer " + token,
        'Content-Type' : 'application/json'    
    }
  };

axios(request_values)
    .then(function (response) {
      if (response.status == 200)
      {
          console.log("Success");
          console.log(response.data);
      }
    })
    .catch (function (error) {
        console.log('Error: ' + error.message);
    });
    

OUTPUT

What you should get: json with the list of the first 25 workspaces your user has access to.

Element Json Comments
Workspace ID ['workspaces'][N]['id'] where N is the N-th workspace in the list.
Workspace name ['workspaces'][N]['name'] where N is the N-th workspace in the list.

Output Json sample

{'filter_by': '',
 'limit': 25,
 'offset': 0,
 'order_by': 'name',
 'order_direction': 'asc',
 'paging': {'next': '/api/users/me/workspaces?offset=25&limit=25&query=&order_by=name&order_direction=asc&filter_by=',
            'prev': None,
            'self': '/api/users/me/workspaces?offset=0&limit=25&query=&order_by=name&order_direction=asc&filter_by='},
 'query': '',
 'size': 25,
 'total': 1026,
 'workspaces': [{'active_users_count': 0,
                 'created_at': '2012-11-14T22:49:17.000Z',
                 'default_role_id': None,
                 'description': '',
                 'favorite': 0,
                 'id': 45,
                 'name': 'Use Case: Product Development',
                 'organization': {'default_public_workspace_role_id': 2,
                                  'id': 4,
                                  'name': 'Bluescape'},
                 'organization_id': 4,
                 'public': True,
                 'publish_state': 'not_published',
                 'publish_state_at': None,
                 'published_at': None,
                 'published_url': None,
                 'uid': 'jyUEffzKgaXYvBkfypBg',
                 'updated_at': '2019-04-18T21:06:11.000Z',
                 'users_count': 1,
                 'workspace_owner': {'avatar_url': None,
                                     'created_at': '2013-08-06T05:33:25.000Z',
                                     'email': 'marcel.dubois@bluescape.com',
                                     'first_name': 'Marcel',
                                     'id': 478,
                                     'industry': 'Communications',
                                     'last_name': 'Dubois',
                                     'locked_at': None,
                                     'phone_number': '',
                                     'title': None,
                                     'updated_at': '2019-06-20T16:28:17.000Z'},
                 'workspace_role': {'can_add_user': True,
                                    'can_at_mention': True,
                                    'can_change_user_role': True,
                                    'can_comment': True,
                                    'can_download_assets': True,
                                    'can_edit_workspace_content': True,
                                    'can_list_collaborators': True,
                                    'can_remove_user': True,
                                    'can_send_message': True,
                                    'can_send_to_wall': True,
                                    'can_view_workspace_content': True,
                                    'can_view_workspace_settings': True,
                                    'description': 'Editor+ can view workspace '
                                                   'settings, can view, '
                                                   'comment and edit '
                                                   'workspaces content, and '
                                                   'can add and edit '
                                                   'collaborators',
                                    'display_order': 2,
                                    'id': 2,
                                    'is_custom': False,
                                    'name': 'Editor+',
                                    'type': 'user'}},
…
…
…
                                      'display_order': 2,
                                    'id': 2,
                                    'is_custom': False,
                                    'name': 'Editor+',
                                    'type': 'user'}}
                ]
}         

If you have any questions or comments, please contact us at Bluescape support.