次の方法で共有


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.

Note

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}

Note

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, credential: TokenCredential | None = None)

Parameters

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

DEPRECATED The 'token_provider' parameter is deprecated and will be removed in a future version. Please use 'credential' parameter with azure.core.credentials.TokenCredential implementations instead.

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
credential
<xref:sempy.fabric.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

Methods

get_paged

GET request to the Fabric REST API that handles pagination.

get_paged_iterator

GET request to the Fabric REST API that handles pagination with iteration.

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, key: str = 'value', *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
key
str

The key in the response JSON that contains the list of rows.

Default value: value
*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.

get_paged_iterator

GET request to the Fabric REST API that handles pagination with iteration.

get_paged_iterator(path_or_url: str, *args, key: str = 'value', **kwargs) -> Iterator[Any]

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.

*args
Required

Arguments passed to the request method.

key
str

The key in the response JSON that contains the list of rows.

Default value: "value"
**kwargs
Required

Arguments passed to the request method.

Keyword-Only Parameters

Name Description
key
Default value: value

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, lro_retry_after: float = 1, lro_back_off_factor: float = 2, lro_max_wait_seconds: float = 60, *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
lro_retry_after

The initial retry interval in seconds between each attempt to check the operation status.

Default value: 1
lro_back_off_factor

The backoff factor to apply to the retry interval between each attempt to check the operation status.

Default value: 2
lro_max_wait_seconds
int

The maximum total wait time in seconds for the long-running-operation to complete.

Default value: 60
*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.