Forum Discussion
Upload a JSON file using Power BI API
FelixC I thought json files were only for importing dataflows.
Imports - Post Import - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Is this being set? Hard to see in your screen shots:
- 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.
Greg_Deckler
Yes, Content-Type is set to "multipart/form-data", you can click on screenshot to open image.
I'm new with PowerBi and this API so maybe it's not the good way to create dataset.
I just want to create new dataset in Power BI online service from a web server with json or directly from my database. This has to be automatic so I can't use Power BI Desktop.
- Greg_Deckler4 years agoCommunity Champion
FelixC Here's what I would try. Create a small, couple MB PBIX file and see if you can post it as a dataset using the API. This should remove any doubt about whether it is something you are doing wrong in postman or it is simply that you are trying to do something that is not supported with a JSON file. I can't find any information about using JSON to create datasets other than maybe Push datasets. This article claims to do what you want to do but doesn't actually use the Power BI REST API, I think the author is confused.
Importing data from JSON files and Power BI Rest APIs into Power BI (sqlshack.com)
- FelixC4 years agoNew Member
@Greg_Deckler
I just tried and it works with a PBIX file so maybe it's not possible with json.
I read this article but the author use an external api to generate data and connect PowerBI desktop on it and that's not what I want.
It's really strange there is no way to add new data from json or database to PowerBI online like in PowerBI desktop.
Maybe I sould create a new ticket for this question.- Anonymous4 years agoNot applicable
Hi FelixC
I think you can try Post Import or Post Import in Group Rest API to import Json File in your My Workspace or App Workspaces.
For reference:
Imports - Post Import In Group
To use this Rest API, you need Dataset.ReadWrite.All permission. You can select it in API Permission in Azure portal.
You can use "Try it" to have a test from Link. If you configure your APP correctly, you should succeed.
I suggest you to check your Authorization Bear token. I can get access token by API in Postman then copy this bear token into Authorization pane instead of adding it in Header pane.
For reference: Power BI REST API using postman - generate embed token.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.