Dataset transfer between tenants¶
Starting with Metadata API v4, datasets can now be moved or copied between different tenants.
The SDK has been extended to support this new functionality with two methods in the Metadata client: MoveDatasetToTenantAsync and CopyDatasetToTenantAsync.
These methods are asynchronous so the process to move or copy is not completed instantly.
It is required to be owner of both tenants to use this functionality.
Move dataset¶
REST API¶
"V4"
POST/api/metadata/dataset/{id}/move
Moves a dataset to a target project in another tenant.
Required scopes: platform_metadata_conversion
Required roles (in both tenants): owner
Parameters¶
| Name | Description | Type | Required |
|---|---|---|---|
id |
Dataset identifier | string (uuid) | yes |
api-version |
Requested API version | string | yes |
Request body (application/json-patch+json)¶
{
"targetProjectId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"targetTenantId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}
cURL Example¶
curl -X POST "https://api.mike-cloud-dev.com/api/metadata/dataset/dddddddd-dddd-dddd-dddd-dddddddddddd/move" \
-H "accept: text/plain" \
-H "api-version: 4" \
-H "Content-Type: application/json-patch+json" \
-H "Authorization: Bearer <access_token>" \
--data-raw '{
"targetProjectId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"targetTenantId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}'
Copy dataset¶
REST API¶
"V4"
POST/api/metadata/dataset/{id}/copy
Copies a dataset to a target project in another tenant.
Required scopes: platform_metadata_conversion
Required roles (in both tenants): owner
Parameters¶
| Name | Description | Type | Required |
|---|---|---|---|
id |
Dataset identifier | string (uuid) | yes |
api-version |
Requested API version | string | yes |
Request body (application/json-patch+json)¶
{
"targetProjectId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"targetTenantId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}
cURL Example¶
curl -X POST "https://api.mike-cloud-dev.com/api/metadata/dataset/dddddddd-dddd-dddd-dddd-dddddddddddd/copy" \
-H "accept: text/plain" \
-H "api-version: 4" \
-H "Content-Type: application/json-patch+json" \
-H "Authorization: Bearer <access_token>" \
--data-raw '{
"targetProjectId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"targetTenantId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}'
¶
curl -X POST "https://api.mike-cloud-dev.com/api/metadata/dataset/dddddddd-dddd-dddd-dddd-dddddddddddd/copy" \
-H "accept: text/plain" \
-H "api-version: 4" \
-H "Content-Type: application/json-patch+json" \
-H "Authorization: Bearer <access_token>" \
--data-raw '{
"targetProjectId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"targetTenantId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}'
SDK Usage¶
MoveDatasetToTenantAsync¶
public async Task<TransferSummaryOutput> MoveDatasetToTenantAsync(
Guid datasetId,
Guid targetProjectId,
Guid targetTenant,
CancellationToken cancellationToken = default)
Example¶
var summary = await metadataClient.MoveDatasetToTenantAsync(
datasetId: sourceDatasetId,
targetProjectId: destinationProjectId,
targetTenant: destinationTenantId);
Console.WriteLine($"Move status {summary.Status}, transfer ID: {summary.Id}");
CopyDatasetToTenantAsync¶
public async Task<TransferSummaryOutput> CopyDatasetToTenantAsync(
Guid datasetId,
Guid targetProjectId,
Guid targetTenant,
CancellationToken cancellationToken = default)
Example¶
var summary = await metadataClient.CopyDatasetToTenantAsync(
datasetId: sourceDatasetId,
targetProjectId: destinationProjectId,
targetTenant: destinationTenantId);
Console.WriteLine($"Copy Status: {summary.Status}, transfer ID: {summary.Id}");
Response and Tracking¶
Both the API and SDK operations (MoveDatasetToTenantAsync and CopyDatasetToTenantAsync) return a transfer summary upon successful initiation of a dataset move or copy.
The response includes a transfer ID (id in the JSON body, or Id in the SDK model), which uniquely identifies the transfer operation. This transfer ID can be used to track the progress and final status of the dataset transfer.
More information available in the chapter "Monitoring running transfers".
Notes¶
- Both
MoveDatasetToTenantAsyncandCopyDatasetToTenantAsyncrequire ownership of both tenants. - Responses contain transfer ids useful for tracking transfer progress.
- Moving a dataset removes it from the source tenant after a successful operation.
- Copying a dataset retains the source dataset.
Related¶
TransferSummaryOutput— output model for transfer operations- Event schema — events emitted during dataset transfer