Forum Discussion
Power BI upload action not working
We are trying to upload a file using powerBI import API. But it keeps throwing 400 Bad request
with the below responseResponse
{
"error": {
"code":"UnknownError",
"pbi.error": {
"code":"UnknownError",
"parameters":{},
"details":[],
"exceptionCulprit":1
}
}
}
API referred: https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimport
The following is my request.
URL: https://api.powerbi.com/v1.0/myorg/imports?datasetDisplayName=demo
Header: Authorization: Bearer <token>, Content-Type: multipart/form-data; boundary=JLQPFBPUP0
Body:
--JLQPFBPUP0
Content-Disposition: form-data; name=model.csv; filename=model.csv;
Content-Type: text/csv
name,age
John,12
--JLQPFBPUP0--
Code:
require 'rest-client'
url = https://api.powerbi.com/v1.0/myorg/imports?datasetDisplayName=demo
payload = "--JLQPFBPUP0
Content-Disposition: form-data; name=model.csv; filename=model.csv;
Content-Type: text/csv
name,age
John,12
--JLQPFBPUP0--"
RestClient.post(url, payload, :authorization => "Bearer <token>", :content_type => "multipart/form-data; boundary=JLQPFBPUP0")
1 Reply
- Greg_DecklerCommunity Champion
Well, a 400 error generally indicates that the server doen't understand the request or the request is corrupt, etc.
You could check the Issues forum here:
https://community.powerbi.com/t5/Issues/idb-p/Issues
And if it is not there, then you could post it.
If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".