Retrieving workspaces

List delegated workspaces

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

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

const workspaces = await api.workspaces.list({
  limit: 20,
});
curl "https://api.fabric.so/v2/workspaces?limit=20" \
  -H 'X-Api-Key: <FABRIC_API_KEY>'

Querying data within a delegated workspace

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.resourceRoots.list({
  limit: 20,
}, { workspaceId: <WORKSPACE_ID> });
curl "https://api.fabric.so/v2/resource-roots?limit=20" \
  -H 'X-Api-Key: <FABRIC_API_KEY>' \
  -H 'X-Fabric-Workspace-Id: <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.