Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi,
I'm trying to upload a small json file to create a new dataset using the import API with Postman but I always get 400 Bad Request (RequestedFileIsEncryptedOrCorrupted) as response.
Here is the response
{
"error": {
"code": "RequestedFileIsEncryptedOrCorrupted",
"pbi.error": {
"code": "RequestedFileIsEncryptedOrCorrupted",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}
The content of my json
[
{
"id": 1,
"name": "Luke",
"randomNumber" : 5.854668
},
{
"id": 2,
"name": "Lisa",
"randomNumber" : 10.3846846
},
{
"id": 3,
"name": "Tom",
"randomNumber" : 52.36541
}
]
Postman snapshots
I also tried with others .json and .xlsx but I get the same error and I don't know why, maybe I missed something in the doc.
Thanks for help!
@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:
@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.
@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)
@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.
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 Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
how in the "Try it" I can upload my json file?
Thanks for your help
Hi @FelixC
According to the blog, Power BI supports us to create a dataflow from a model.json file.
datasetDisplayName
to model.json, as described in URI parameters.We can use dataflow as the datasource to create a dataset.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes, but here
I can't add my file and I don't know how to encode the file as form data in this form.
In postman there is a section for "form data" file and it works for pbix file but not for json.
Félix
Hi @FelixC
I find a post with similar requirement like yours. I hope it could help you.
For reference: Power BI API Dataflow Import Operation
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-rzhou-msft,
Thanks for the link, I'll give it a try.
So after multiple research it is not possible to add data in dataset from a json. This API route is used to create dataflow!
Best Regards
Félix
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
14 | |
2 | |
1 | |
1 | |
1 |