Forum Discussion

FelixC's avatar
FelixC
New Member
4 years ago

Upload a JSON file using Power BI API

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!

10 Replies

    • FelixC's avatar
      FelixC
      New Member

      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_Deckler's avatar
        Greg_Deckler
        Community 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)