Share via


FabricRestClient Class

REST client to access Fabric REST endpoints. Authentication tokens are automatically acquired from the execution environment.

All methods (get, post, ...) have an additional parameter lro_wait that can be set to True to wait for the long-running-operation to complete.

⚠️ Notice: This class is experimental and may be subject to change in future versions. We recommend using only the functions listed below. Use of any other functionality is discouraged and may lead to unexpected behavior.

Supported Functions

Resource

API

Example

Capacities

List Capacities

GET /v1/capacities

Workspaces

Create Workspace

POST /v1/workspaces

Workspaces

Delete Workspace

DELETE /v1/workspaces/{workspaceId}

Workspaces

Get Workspace

GET /v1/workspaces/{workspaceId}

Workspaces

List Workspace

GET /v1/workspaces

Items

List Items

GET /v1/workspaces/{workspaceId}/items

Items

Create Items

POST /v1/workspaces/{workspaceId}/items

Items

Delete Items

DELETE /v1/workspaces/{workspaceId}/items/{itemId}

Items

Get Items

GET /v1/workspaces/{workspaceId}/items/{itemId}

Long Running Operations

Get Operation Result

GET /v1/operations/{operationId}/result

Long Running Operations

Get Operation State

GET /v1/operations/{operationId}

PREVIEW* Folders

Create Folder

POST /v1/workspaces/{workspaceId}/folders

PREVIEW* Folders

Delete Folder

DELETE /v1/workspaces/{workspaceId}/folders/{folderId}

PREVIEW* Folders

Get Folder

GET /v1/workspaces/{workspaceId}/folders/{folderId}

PREVIEW* Folders

List Folder

GET /v1/workspaces/{workspaceId}/folders

PREVIEW* Folders

Move Folder

POST /v1/workspaces/{workspaceId}/folders/{folderId}/move

PREVIEW* Folders

Update Folder

PATCH /v1/workspaces/{workspaceId}/folders/{folderId}

⚠️ Notice: Resources labeled as PREVIEW are subject to change and may be updated or modified in future releases.

Constructor

FabricRestClient(token_provider: TokenProvider | None = None, retry_config: Dict | None = None)

Parameters

Name Description
token_provider
<xref:sempy.fabric.TokenProvider>

Implementation of TokenProvider that can provide auth token for access to the PowerBI workspace. Will attempt to acquire token from its execution environment if not provided.

Default value: None
retry_config

Configuration for the retry strategy. The following keys are filled with default values if not provided:

  • total: int, default=10
  • allowed_methods: list, default=["HEAD", "GET", "POST", "PUT", "PATCH", "DELETE"]
  • status_forcelist: list, default=[429, 502, 503, 504]
  • backoff_factor: int, default=1
  • raise_on_status: bool, default=False
Default value: None

Methods

get_paged

GET request to the Fabric REST API that handles pagination.

request

Request to the Fabric REST API.

get_paged

GET request to the Fabric REST API that handles pagination.

get_paged(path_or_url: str, headers: Dict | None = None, *args, **kwargs) -> list

Parameters

Name Description
path_or_url
Required
str

The relative path to the resource or the full url. If it's relative, the base URL is automatically prepended.

headers

Headers to be included in the request.

Default value: None
*args
Required

Arguments passed to the request method.

**kwargs
Required

Arguments passed to the request method.

Returns

Type Description

The list of rows from the response.

request

Request to the Fabric REST API.

request(method: str, path_or_url: str, lro_wait: bool | None = False, lro_max_attempts: int = 10, lro_operation_name: str | None = None, *args, **kwargs)

Parameters

Name Description
method
Required
str

HTTP method.

path_or_url
Required
str

The path or the url to the resource.

lro_wait

If True, waits for the long-running-operation to complete.

Default value: False
lro_max_attempts
int

The maximum number of attempts to wait for the long-running-operation to complete.

Default value: 10
lro_operation_name
str

The name of the operation to wait for displayed via TQDM.

Default value: None
*args
Required

Arguments passed to the request method.

**kwargs
Required

Arguments passed to the request method.

Returns

Type Description

The response from the REST API.