Retrieving workspaces

Fetch delegated workspaces

To retrieve a list of delegated workspaces, provide parent id of the current workspace as parent.

import { Fabric } from '@fbrc/sdk';

const api = new Fabric({
  apiKey: process.env.FABRIC_API_KEY!,
});

const developerWorkpsace = await api.workspace.current({});

const workspaces = await api.workspace.list({
  limit: 20,
  parentWorkspaceId: developerWorkpsace.id,
});

Querying specific delegated workspace data

All API endpoints support querying a specific delegated workspace by including the following HTTP header in your request:

X-Fabric-Workspace-Id: <WORKSPACE_ID>

or

import { Fabric } from '@fbrc/sdk';

const api = new Fabric({
  apiKey: process.env.FABRIC_API_KEY!,
  workspaceId: <WORKSPACE_ID>,
});

or

import { Fabric } from '@fbrc/sdk';

const api = new Fabric({
  apiKey: process.env.FABRIC_API_KEY!,
});

await api.resourceRoot.list({
  limit: 20,
}, { workspaceId: <WORKSPACE_ID> });

Where <WORKSPACE_ID> is the ID of the delegated workspace you want to query.

If the header is not provided, requests are executed against the workspace associated with the developer API key.