最近の検索
最近の検索はありません

rajesh parmar
参加日2024年11月26日
·
前回のアクティビティ2024年11月27日
フォロー中
0
フォロワー
0
合計アクティビティ
3
投票
0
サブスクリプション
1
アクティビティの概要
バッジ
記事
投稿
コミュニティへのコメント
記事へのコメント
アクティビティの概要
さんの最近のアクティビティ rajesh parmar
rajesh parmarさんがコメントを作成しました:
Erica Girges
i add ‘application/binary’ as contentType but still not work
コメントを表示 · 投稿日時:2024年11月27日 · rajesh parmar
0
フォロワー
0
投票
0
コメント
rajesh parmarさんがコメントを作成しました:
Hello Tipene Hughes
I have an issue with the POST request using client.request. Here is the code I'm working with:
const base64Response = await fetch(mediaData.data);
const blobData = await base64Response.blob();
const file = new File([blobData], mediaData.fileName, {
type: blobData.type,
});
const formData = new FormData();
formData.append("media", file);
formData.append("title", file.name);
formData.append("content_type", file.type);
formData.append("account", spokiAccount?.id);
const metadata = await client.metadata();
const sendMedia = await client.request({
url: `${BASE_URL}/media/`,
type: "POST",
data: formData,
headers: {
"Content-Type": "multipart/form-data",
[zendeskHeaderKey]: typeof metadata.installationId === "string" ? spokiAccessKey : "{{setting.spokiAccessKey}}",
},
secure: !(typeof metadata.installationId === "string"),
});
The issue is that when I make the API call using Axios, like this:
const sendMedia = await axios.post(`${BASE_URL}/media/`, formData, {
headers: {
"Content-Type": "multipart/form-data",
...spokiHeaders,
},
});
It works fine and returns a response. However, when I call the API using the client.request, the payload doesn’t show up in the browser, and I get a 400 error with the following message:
{
"media": [
"No file was submitted."
]
}
Can you help me identify what might be wrong with the client.request approach?
コメントを表示 · 編集日時:2024年11月26日 · rajesh parmar
0
フォロワー
0
投票
0
コメント