cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TimCurwick Frequent Visitor
Frequent Visitor

Import to group via API

I am working on a PowerShell function to import .pbix files via the API. The main functionality is taken from the oft referenced sample code here https://github.com/Azure-Samples/powerbi-powershell/blob/master/copyWorkspace.ps1.

 

The code works perfrectly when posting to My Workspace.

The initial Post gets a response with HTTP status code 202 Accepted, and an ID for the import.

When the import is queried via the API, the import details are returned.

In PBI, the new report and dataset are present.

 

But when I run it against a group, the import is posted successfully, but then disappears.

The initial Post gets a response with HTTP status code 202 Accepted, and an ID for the import.

When the import is queried via the API, a 404 Not Found error is returned.

When all imports are queried via the API, there are no new imports listed.

In PBI, the new report and dataset never show up.

 

Any idea why this might not be working?

 

As it works for My Workspace, and the post is accepted for a group, and there are no errors, and that chunk of code is the same as what works for everyone else, I'm thinking it's not my code, but something with PBI. Permissions issue? Group configuration issue? Bug? Any ideas?

 

Thanks,

Tim Curwick

1 ACCEPTED SOLUTION

Accepted Solutions
TimCurwick Frequent Visitor
Frequent Visitor

Re: Import to group via API

I narrowed down the bug and found a workaround. (Or rather, I found the workaround, which informed the bug.)

 

The API is generally case insensitive. As a long time PowerShell guy, I default to initial caps in such circumstances, as that's what PowerShell people are used to. Turns out this bug only appears when /groups is not in all lowercase. /Imports can be in whatever case you want. /Groups can be whatever case you want in other API calls.

 

But when creating a new import job, this works:

https://api.powerbi.com/v1.0/myorg/groups/[guid]/ImPoRtS?datasetDisplayName=TestFile.pbix

And this leads to the bug:

https://api.powerbi.com/v1.0/myorg/Groups/[guid]/Imports?datasetDisplayName=TestFile.pbix

 

Thanks,

Tim Curwick.

1 REPLY 1
TimCurwick Frequent Visitor
Frequent Visitor

Re: Import to group via API

I narrowed down the bug and found a workaround. (Or rather, I found the workaround, which informed the bug.)

 

The API is generally case insensitive. As a long time PowerShell guy, I default to initial caps in such circumstances, as that's what PowerShell people are used to. Turns out this bug only appears when /groups is not in all lowercase. /Imports can be in whatever case you want. /Groups can be whatever case you want in other API calls.

 

But when creating a new import job, this works:

https://api.powerbi.com/v1.0/myorg/groups/[guid]/ImPoRtS?datasetDisplayName=TestFile.pbix

And this leads to the bug:

https://api.powerbi.com/v1.0/myorg/Groups/[guid]/Imports?datasetDisplayName=TestFile.pbix

 

Thanks,

Tim Curwick.

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 375 members 4,065 guests
Please welcome our newest community members: