Workspaces

A Workspace is a lightweight way to organize related resources inside a single Files.com Site.

Customers commonly group resources by project, department, client, or region. Workspaces provide a built-in structure for that grouping, so the UI can operate within a clear “workspace context” and admins can delegate management for a subset of resources without requiring full site-level isolation.

Every Site has an implicit Default workspace (ID 0). Resources that are not explicitly assigned to a named workspace are considered part of the Default workspace.

List Workspaces

SDK Method

\Files\Model\Workspace::list;

Return Object

Workspace[]

Authorization Requirement

Available to all authenticated keys or sessions.

Additional Arguments

Example Request

try {
  $workspaces = \Files\Model\Workspace::list();
  foreach ($workspaces as $workspace) {
    // Operate on $workspace
  }
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Show Workspace

SDK Method

\Files\Model\Workspace::find;

Return Object

Workspace

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
id
int64
Required
Workspace ID.

Example Request

try {
  $workspace = \Files\Model\Workspace::find($id);
  // Operate on $workspace
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Create Workspace

SDK Method

\Files\Model\Workspace::create;

Return Object

Workspace

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
name
string
Workspace name

Example Request

try {
  $workspace = \Files\Model\Workspace::create([
    'name' => "Project Alpha"
  ]);
  // Operate on $workspace
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Update Workspace

SDK Method

$workspace->update;

Return Object

Workspace

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
name
string
Workspace name

Example Request

try {
  // Find the workspace object by its id.
  $workspace = \Files\Model\Workspace::find(id);
  $workspace->update([
    'name' => "Project Alpha"
  ]);
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Delete Workspace

SDK Method

$workspace->delete;

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

try {
  // Find the workspace object by its id.
  $workspace = \Files\Model\Workspace::find(id);
  $workspace->delete();
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

The Workspace Object

Some of the methods above return a Workspace object. The attributes of this object are listed below.

AttributeDescription
id
int64
Workspace ID
name
string
Workspace name