# Managing Workspaces

Workspaces are created inside a [**Universe**](https://docs.shimoku.com/dev/building-web-app/management/managing-universes). Any number of Workspaces can be created.

A workspace has a [**set of suites**](https://docs.shimoku.com/dev/building-web-app/management/broken-reference) that can be viewed by an admin user and an unlimited number of viewer users. Managing workspaces with Shimoku’s SDK goes as follows:

The `s.workspaces` module has the following methods:

* `get_workspace(uuid: Optional[str], name: Optional[str])` to retrieve workspace data.
* `create_workspace(name: str, create_default_roles: bool, theme: Optional[Dict])` to create a new workspace in your universe owned by the user `owner_id` and with name. Workspaces with names too similar will not be allowed.&#x20;
* `update_workspace(uuid: Optional[str], name: Optional[str], new_name: Optional[str], theme: Optional[Dict])` to update the data of a workspace.
* `delete_workspace(uuid: Optional[str], name: Optional[str])` to retrieve workspace data.
* `get_workspace_menu_paths(uuid: Optional[str] = None, name: Optional[str] = None)` to retrieve all the menu paths of a workspace.
* `get_workspace_menu_path_ids(uuid: Optional[str] = None, name: Optional[str] = None)` to retrieve all the menu path ids of a workspace.
* `get_workspace_boards(uuid: Optional[str] = None, name: Optional[str] = None)` to retrieve all the boards of a workspace.
* `delete_all_workspace_menu_paths(uuid: Optional[str], name: Optional[str])` to delete all menu paths in a workspace.
* `delete_all_workspace_boards(uuid: Optional[str], name: Optional[str])` to delete all boars in a workspace.
* `change_boards_order(uuid: Optional[str], name: Optional[str], boards: List[str])` to change the order of the boards.
* `change_menu_order(uuid: Optional[str], name: Optional[str], menu_order: List[Union[str, Tuple[str, List[str]])` to order the menu paths and it's sub-paths.

## **The Methods**

### **1. Get workspace** <a href="#id-1.-get_business" id="id-1.-get_business"></a>

```python
workspace: Dict[str, Any] = s.workspaces.get_workspace(workspace_id)
```

That returns a dictionary such as:

```python
workspace: Dict = {
  'id': 'f74gh9',  # workspace uuid
  'name': 'Ikea',  # workspace name
  'owner': '38c7f',  # user uuid
  'createdAt': '2021-01-01',
  'updatedAt '2021-09-24',
}
```

### **2. Get workspace menu paths** <a href="#id-2.-get_business_apps" id="id-2.-get_business_apps"></a>

```python
menu_paths: List[Dict[str, Any]] = \
s.workspaces.get_all_workspace_menu_paths(workspace_id)
```

That returns a dictionary such as:

```python
menu_paths = [
  {
    'id': 'aaaa1'  # workspace uuid
    'owner': '38c7f',  # user uuid
    'createdAt': '2021-01-01',
    'updatedAt '2021-09-24',
    ...
  },
  {
    'id': 'bbbb1'  # workspace uuid
    'owner': '38c7f  # user uuid
    'createdAt': '2021-01-01',
    'updatedAt '2021-09-24',
     ...
  },
]
```

### **3. Get** workspaces **menu path ids** <a href="#id-3.-get_business_app_ids" id="id-3.-get_business_app_ids"></a>

```python
menu_path_ids: List[str] = \
s.workspaces.get_all_workspace_menu_path_ids(workspace_id)
```

That returns a dictionary such as:

```python
# This workspace contains 3 menu paths
menu_path_ids = [
  'a19f1',  # a menu path UUID
  '920a0',  # another menu path UUID
  'c5d1d',  # another menu path UUID
]
```

Such as in:

![](https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FuyxjCthFl4N3nNEv6hNR%2F02-overview-img2.png?alt=media\&token=48b876cb-a576-4c9c-9da9-1175bfbb7a7a)

### **4. Create workspace** <a href="#id-4.-create_business" id="id-4.-create_business"></a>

```python
workspace: Dict = s.workspaces.create_workspace(name)
```

That returns the workspace created:

```python
workspace = {
  'id': 'f74gh9',  # workspace uuid
  'name': 'Ikea',  # workspace name
  'owner': '38c7f',  # user uuid
  'createdAt': '2021-01-01',
  'updatedAt '2021-09-24',
}
```
