Похожие чаты

I just found some but in your code. i don't

it will work or not. so test it.
const postImport = async function (stream, groupId, datasetDisplayName, isPaginatedReport) {
let url = null;
try {
console.log("* postImport *");
url = `https://api.powerbi.com/v1.0/myorg/groups/${groupId}/imports?datasetDisplayName=${datasetDisplayName}&${isPaginatedReport ? 'nameConflict=Abort' : 'nameConflict=CreateOrOverwrite'}`
const headers = await this.#powerBIAuth.getRequestHeader();
const form_data = new FormData();
form_data.append("value", stream);
function getLength() {
return new Promise((res, rej) => {
form_data.getLength((err, length) => {
if (err) {
return rej(err);
}
res(length);
})
})
}
const contentLength = await getLength();
const request_config = {
method: "post",
url: url,
headers: {
Authorization: headers.Authorization,
'Content-type': "multipart/form-data",
"Content-Length": contentLength
},
data: form_data
};
const response = await axios.request(request_config);
console.log('======================= postImport function completed');
return response
} catch (error) {
console.log("* post import error *");
if (error.response.data.error.code === "ReportWithDisplayNameForTheModelExists") {
this.url = "https://api.powerbi.com/v1.0/myorg/groups/${groupId}/imports?datasetDisplayName=${datasetDisplayName}&nameConflict=Overwrite";
const response = await this.postImport(stream, groupId, datasetDisplayName, isPaginatedReport)
return response
}
console.log(JSON.stringify(error));
if (error.response) {
throw new ErrorHandler(JSON.stringify(error.response.data.error), error.response.status);
} else {
throw error
}
}
};

1 ответов

38 просмотров

The url variable value is not changing .

Похожие вопросы

Обсуждают сегодня

Hey everyone! I won’t focus too much on what this person said (it’s clear they don’t understand the scope of what TF and TELOSX are achieving), but I’ll put it simply for thos...
Ana Ojeda
3
Hi did any of you experience a file error when download hex file for Windows?
Valya
17
как правильно удалить сддм? прописал в etc/portage.use/plasma-meta -sddm , но при обновлении юзов мне предлагает поставить lightdm (ещё лучше 😡), добавил туда - display-manage...
REDis
25
Всем привет! Имеется функция: function IsValidChar(ch: UTF8Char): Boolean; var i: Integer; ValidChars: AnsiString; begin ValidChars := 'abcdefghijklmnopqrstuvwxyzABCDE...
Евгений
44
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Also, scrolling at the history here, I see there was alot of hate towards kaspa.. is it still the case after they proved the history of the chain?
Gad Levy | AnyLog
11
Please I want to ask if my stake is 24% complete, what penalty will I pay if I end the stake?
Crypto Advocate
12
Коллеги, я тут для личных нужд пошел ставить MQTT сервер, пощупал mosquitto, но ужаснулся отсутствию такой банальности, как HTTP API для посмотреть список топиков. А тут что,...
Maksim Lapshin
14
Could the new Norse labs apps have just been called "VPN" instead of DVPN?
HDGVII
14
How will they work it out?
Max
14
Карта сайта