แชร์ผ่าน


Imports - Post Import In Group

Creates new content in the specified workspace.

Note

Supported content:

  • Power BI .pbix files
  • JSON files (.json)
  • Excel files (.xlsx)
  • SQL Server Report Definition Language files (.rdl)
  • To import a file, specify the content type multipart/form-data in the request headers and encode the file as form data in the request body.
  • To import an .rdl file, include the file extension in the name specified by datasetDisplayName, as described in URI parameters.
  • To import an .xlsx file from OneDrive for Business, include the content type application/json in the request headers. Include ImportInfo with filePath set to the .xlsx file path in the request body.
  • To import large Power BI .pbix files that are between 1 GB and 10 GB in size, see Create Temporary Upload Location In Group and the Import Large Files PowerShell script. This is only supported for Premium capacity workspaces.
  • To create a dataflow from a model.json file, set datasetDisplayName to model.json, as described in URI parameters.

Permissions

This API call can be called by a service principal profile. For more information see: Service principal profiles in Power BI Embedded.

Required Scope

Dataset.ReadWrite.All

Limitations

  • Dataflows with service principal aren't supported.
  • Importing a Power BI .pbix file from OneDrive isn't supported.
  • Importing a file that has a protected sensitivity label isn't supported for service principals.

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/imports?datasetDisplayName={datasetDisplayName}
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/imports?datasetDisplayName={datasetDisplayName}&nameConflict={nameConflict}&skipReport={skipReport}&overrideReportLabel={overrideReportLabel}&overrideModelLabel={overrideModelLabel}&subfolderObjectId={subfolderObjectId}

URI Parameters

Name In Required Type Description
groupId
path True

string

uuid

The workspace ID

datasetDisplayName
query True

string

The display name of the dataset should include file extension. Not supported when importing from OneDrive for Business. For importing or creating dataflows, this parameter should be hardcoded to model.json.

nameConflict
query

ImportConflictHandlerMode

Specifies what to do if a dataset with the same name already exists. The default value is Ignore. For RDL files, Abort and Overwrite are the only supported options. For dataflow model.json files, Abort and GenerateUniqueName are the only supported options.

overrideModelLabel
query

boolean

Determines whether to override the existing label on a model when republishing a Power BI .pbix file. The service default value is true.

overrideReportLabel
query

boolean

Whether to override the existing label on a report when republishing a Power BI .pbix file. The service default value is true.

skipReport
query

boolean

Whether to skip report import. If specified, the value must be true. Only supported for Power BI .pbix files.

subfolderObjectId
query

string

uuid

The subfolder ID to import the file to subfolder.

Request Body

Media Types: "application/json", "multipart/form-data"

Name Type Description
connectionType

connectionType

The import connection type for a OneDrive for Business file

filePath

string

The path of the OneDrive for Business Excel (.xlsx) file to import, which can be absolute or relative. Power BI .pbix files aren't supported.

fileUrl

string

The shared access signature URL of the temporary blob storage used to import large Power BI .pbix files between 1 GB and 10 GB in size.

Responses

Name Type Description
200 OK

Import

OK

202 Accepted

Import

Accepted

Examples

Import dataflow model.json example
Post import example
Post import skip report example

Import dataflow model.json example

Sample request

POST https://api.powerbi.com/v1.0/myorg/groups/cfafbeb1-8037-4d0c-896e-a46fb27ff229/imports?datasetDisplayName=model.json&nameConflict=Abort&skipReport=True
{
  "value": "--f05e5244-f876-43b9-bc87-d71598f6b32a Content-Disposition: form-data name=model.json; filename=model.json Content-Type: application/json [Contents of Model JSON Encoded] --f05e5244-f876-43b9-bc87-d71598f6b32a--"
}

Sample response

{
  "id": "d02b8896-e247-4d83-ae5a-014028cb0665"
}

Post import example

Sample request

POST https://api.powerbi.com/v1.0/myorg/groups/cfafbeb1-8037-4d0c-896e-a46fb27ff229/imports?datasetDisplayName=MyReport&nameConflict=Ignore
{
  "value": "--f05e5244-f876-43b9-bc87-d71598f6b32a Content-Disposition: form-data AA...ZZ --f05e5244-f876-43b9-bc87-d71598f6b32a--"
}

Sample response

{
  "id": "d02b8896-e247-4d83-ae5a-014028cb0665"
}

Post import skip report example

Sample request

POST https://api.powerbi.com/v1.0/myorg/groups/cfafbeb1-8037-4d0c-896e-a46fb27ff229/imports?datasetDisplayName=MyReport&nameConflict=Ignore&skipReport=True&overrideReportLabel=True&overrideModelLabel=True
{
  "value": "--f05e5244-f876-43b9-bc87-d71598f6b32a Content-Disposition: form-data AA...ZZ --f05e5244-f876-43b9-bc87-d71598f6b32a--"
}

Sample response

{
  "id": "d02b8896-e247-4d83-ae5a-014028cb0665"
}

Definitions

Name Description
connectionType

The import connection type for a OneDrive for Business file

Dataset

A Power BI dataset. The API returns a subset of the following list of dataset properties. The subset depends on the API called, caller permissions, and the availability of the data in the Power BI database.

DatasetQueryScaleOutSettings

Query scale-out settings of a dataset

DatasetUser

A Power BI user access right entry for a dataset

DatasetUserAccessRight

The access right that the user has for the dataset (permission level)

DependentDataflow

A Power BI dependent dataflow

Encryption

Encryption information for a dataset

EncryptionStatus

Dataset encryption status

Import

The import object

ImportConflictHandlerMode

Specifies what to do if a dataset with the same name already exists. The default value is Ignore. For RDL files, Abort and Overwrite are the only supported options. For dataflow model.json files, Abort and GenerateUniqueName are the only supported options.

ImportInfo

The information about the import

PrincipalType

The principal type

Report

A Power BI report. The API returns a subset of the following list of report properties. The subset depends on the API called, caller permissions, and the availability of data in the Power BI database.

ReportUser

A Power BI user access right entry for a report

ReportUserAccessRight

The access right that the user has for the report (permission level)

ServicePrincipalProfile

A Power BI service principal profile. Only relevant for Power BI Embedded multi-tenancy solution.

Subscription

An email subscription for a Power BI item (such as a report or a dashboard)

SubscriptionUser

A Power BI email subscription user

connectionType

The import connection type for a OneDrive for Business file

Name Type Description
connect

string

import

string

Dataset

A Power BI dataset. The API returns a subset of the following list of dataset properties. The subset depends on the API called, caller permissions, and the availability of the data in the Power BI database.

Name Type Description
ContentProviderType

string

The content provider type for the dataset

CreateReportEmbedURL

string

The dataset create report embed URL

CreatedDate

string

The dataset creation date and time

Encryption

Encryption

Dataset encryption information. Only applicable when $expand is specified.

IsEffectiveIdentityRequired

boolean

Whether the dataset requires an effective identity, which you must send in a GenerateToken API call.

IsEffectiveIdentityRolesRequired

boolean

Whether row-level security is defined inside the Power BI .pbix file. If so, you must specify a role.

IsInPlaceSharingEnabled

boolean

Whether the dataset can be shared with external users to be consumed in their own tenant

IsOnPremGatewayRequired

boolean

Whether the dataset requires an on-premises data gateway

IsRefreshable

boolean

This field returns true when the dataset is either recently refreshed or is configured for automatic refresh, with the connection mode specifically set to 'Import'. The value will return false for other connection modes, such as 'DirectQuery' and 'LiveConnection', regardless of whether the dataset is manually refreshed or is set up for automatic refresh.

QnaEmbedURL

string

The dataset Q&A embed URL

addRowsAPIEnabled

boolean

Whether the dataset allows adding new rows

configuredBy

string

The dataset owner

description

string

The dataset description

id

string

The dataset ID

name

string

The dataset name

queryScaleOutSettings

DatasetQueryScaleOutSettings

Query scale-out settings of a dataset

targetStorageMode

string

The dataset storage mode

upstreamDataflows

DependentDataflow[]

The list of all the dataflows this item depends on

users

DatasetUser[]

(Empty value) The dataset user access details. This property will be removed from the payload response in an upcoming release. You can retrieve user information on a Power BI item (such as a report or a dashboard) by using the Get Dataset Users as Admin API, or the PostWorkspaceInfo API with the getArtifactUsers parameter.

webUrl

string

The web URL of the dataset

DatasetQueryScaleOutSettings

Query scale-out settings of a dataset

Name Type Description
autoSyncReadOnlyReplicas

boolean

Whether the dataset automatically syncs read-only replicas

maxReadOnlyReplicas

integer

Maximum number of read-only replicas for the dataset (0-64, -1 for automatic number of replicas)

DatasetUser

A Power BI user access right entry for a dataset

Name Type Description
datasetUserAccessRight

DatasetUserAccessRight

The access right that the user has for the dataset (permission level)

displayName

string

Display name of the principal

emailAddress

string

Email address of the user

graphId

string

Identifier of the principal in Microsoft Graph. Only available for admin APIs.

identifier

string

Identifier of the principal

principalType

PrincipalType

The principal type

profile

ServicePrincipalProfile

A Power BI service principal profile. Only relevant for Power BI Embedded multi-tenancy solution.

userType

string

Type of the user.

DatasetUserAccessRight

The access right that the user has for the dataset (permission level)

Name Type Description
None

string

Removes permission to the content in the dataset

Read

string

Grants Read access to the content in the dataset

ReadExplore

string

Grants Read and Explore access to the content in the dataset

ReadReshare

string

Grants Read and Reshare access to the content in the dataset

ReadReshareExplore

string

Grants Read, Reshare, and Explore access to the content in the dataset

ReadWrite

string

Grants Read and Write access to the content in the dataset

ReadWriteExplore

string

Grants Read, Write, and Explore access to the content in the dataset

ReadWriteReshare

string

Grants Read, Write, and Reshare access to the content in the dataset

ReadWriteReshareExplore

string

Grants Read, Write, Reshare, and Explore access to the content in the dataset

DependentDataflow

A Power BI dependent dataflow

Name Type Description
groupId

string

The target group ID

targetDataflowId

string

The target dataflow ID

Encryption

Encryption information for a dataset

Name Type Description
EncryptionStatus

EncryptionStatus

Dataset encryption status

EncryptionStatus

Dataset encryption status

Name Type Description
InSyncWithWorkspace

string

Encryption is supported and is in sync with the encryption settings

NotInSyncWithWorkspace

string

Encryption is supported but isn't in sync with the encryption settings

NotSupported

string

Encryption isn't supported for this dataset

Unknown

string

The encryption status is unknown due to dataset corruption

Import

The import object

Name Type Description
createdDateTime

string

Import creation date and time

datasets

Dataset[]

The datasets associated with this import

id

string

The import ID

importState enum:
  • Failed
  • Publishing
  • Succeeded

The import upload state

name

string

The import name

reports

Report[]

The reports associated with this import

updatedDateTime

string

Import last update date and time

ImportConflictHandlerMode

Specifies what to do if a dataset with the same name already exists. The default value is Ignore. For RDL files, Abort and Overwrite are the only supported options. For dataflow model.json files, Abort and GenerateUniqueName are the only supported options.

Name Type Description
Abort

string

If dataset or dataflow with the same name already exists, the import operation will be cancelled.

CreateOrOverwrite

string

If a dataset with the same name already exists, the import operation will replace the existing dataset with the new one. The import operation will fail if there's more than one existing dataset with the same name.

GenerateUniqueName

string

If a dataflow with the same name already exists, the import operation will generate a new unique name for the new dataflow.

Ignore

string

If a dataset with the same name already exists, the import operation will create a new dataset with the same name.

Overwrite

string

If a dataset with the same name already exists, the import operation will replace the existing dataset with the new one. The import operation will fail if there's no conflict or if there's more than one existing dataset with the same name.

ImportInfo

The information about the import

Name Type Description
connectionType

connectionType

The import connection type for a OneDrive for Business file

filePath

string

The path of the OneDrive for Business Excel (.xlsx) file to import, which can be absolute or relative. Power BI .pbix files aren't supported.

fileUrl

string

The shared access signature URL of the temporary blob storage used to import large Power BI .pbix files between 1 GB and 10 GB in size.

PrincipalType

The principal type

Name Type Description
App

string

Service principal type

Group

string

Group principal type

None

string

No principal type. Use for whole organization level access.

User

string

User principal type

Report

A Power BI report. The API returns a subset of the following list of report properties. The subset depends on the API called, caller permissions, and the availability of data in the Power BI database.

Name Type Description
appId

string

The app ID, returned only if the report belongs to an app

datasetId

string

The dataset ID of the report

description

string

The report description

embedUrl

string

The embed URL of the report

id

string

The report ID

isOwnedByMe

boolean

Determine if the report is created by the current user.

name

string

The name of the report

originalReportId

string

The actual report ID when the workspace is published as an app.

reportType enum:
  • PaginatedReport
  • PowerBIReport

The report type

subscriptions

Subscription[]

(Empty Value) The subscription details for a Power BI item (such as a report or a dashboard). This property will be removed from the payload response in an upcoming release. You can retrieve subscription information for a Power BI report by using the Get Report Subscriptions as Admin API call.

users

ReportUser[]

(Empty value) The user access details for a Power BI report. This property will be removed from the payload response in an upcoming release. You can retrieve user information on a Power BI report by using the Get Report Users as Admin API call, or the PostWorkspaceInfo API call with the getArtifactUsers parameter.

webUrl

string

The web URL of the report

ReportUser

A Power BI user access right entry for a report

Name Type Description
displayName

string

Display name of the principal

emailAddress

string

Email address of the user

graphId

string

Identifier of the principal in Microsoft Graph. Only available for admin APIs.

identifier

string

Identifier of the principal

principalType

PrincipalType

The principal type

profile

ServicePrincipalProfile

A Power BI service principal profile. Only relevant for Power BI Embedded multi-tenancy solution.

reportUserAccessRight

ReportUserAccessRight

The access right that the user has for the report (permission level)

userType

string

Type of the user.

ReportUserAccessRight

The access right that the user has for the report (permission level)

Name Type Description
None

string

No permission to content in report

Owner

string

Grants Read, Write and Reshare access to content in report

Read

string

Grants Read access to content in report

ReadCopy

string

Grants Read and Copy access to content in report

ReadReshare

string

Grants Read and Reshare access to content in report

ReadWrite

string

Grants Read and Write access to content in report

ServicePrincipalProfile

A Power BI service principal profile. Only relevant for Power BI Embedded multi-tenancy solution.

Name Type Description
displayName

string

The service principal profile name

id

string

The service principal profile ID

Subscription

An email subscription for a Power BI item (such as a report or a dashboard)

Name Type Description
artifactDisplayName

string

The name of the subscribed Power BI item (such as a report or a dashboard)

artifactId

string

The ID of the subscribed Power BI item (such as a report or a dashboard)

artifactType

string

The type of Power BI item (for example a Report, Dashboard, or Dataset)

attachmentFormat

string

Format of the report attached in the email subscription

endDate

string

The end date and time of the email subscription

frequency

string

The frequency of the email subscription

id

string

The subscription ID

isEnabled

boolean

Whether the email subscription is enabled

linkToContent

boolean

Whether a subscription link exists in the email subscription

previewImage

boolean

Whether a screenshot of the report exists in the email subscription

startDate

string

The start date and time of the email subscription

subArtifactDisplayName

string

The page name of the subscribed Power BI item, if it's a report.

title

string

The app name

users

SubscriptionUser[]

The details of each email subscriber. When using the Get User Subscriptions As Admin API call, the returned value is an empty array (null). This property will be removed from the payload response in an upcoming release. You can retrieve subscription information on a Power BI report or dashboard by using the Get Report Subscriptions As Admin or Get Dashboard Subscriptions As Admin API calls.

SubscriptionUser

A Power BI email subscription user

Name Type Description
displayName

string

Display name of the principal

emailAddress

string

Email address of the user

graphId

string

Identifier of the principal in Microsoft Graph. Only available for admin APIs.

identifier

string

Identifier of the principal

principalType

PrincipalType

The principal type

profile

ServicePrincipalProfile

A Power BI service principal profile. Only relevant for Power BI Embedded multi-tenancy solution.

userType

string

Type of the user.