Hello,
I am stuck trying to programmatically upload a .pbix file using the import API, making use of the request-promise library which is imported as "rp" here.
I am currently trying the following, which results in HTTP error 400:
let url = 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports'; let options = { method: 'POST', headers: { 'Content-Type': 'multipart/form-data', 'authorization': 'Bearer ' + accessToken }, body: fs.createReadStream(__dirname + '/Report.pbix'), url: 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports' }; rp(options) .then(function (body) { console.log('success! ', body); }) .catch(function (err) { console.log('error', err); });
I also haven't had any success uploading the file using postman, where I have tried it with and without having set Content-Type.
What could I be doing wrong?