Hey guys, I'm try to insert a vector via REST API, but I'm getting ```json { "result": null, "

Hey guys, I'm try to insert a vector via REST API, but I'm getting
{
"result": null,
"success": false,
"errors": [
{
"code": 4000,
"message": "vectorize.vector.missing_part"
}
],
"messages": []
}
{
"result": null,
"success": false,
"errors": [
{
"code": 4000,
"message": "vectorize.vector.missing_part"
}
],
"messages": []
}
I'm creating a blob to simulate as a file and send it via formdata
const blob = new Blob([JSON.stringify({ id, values }) + '\n'], { type: 'application/x-ndjson' });
console.log('blob :', blob);
const formData = new FormData();
formData.append('file', blob, 'data.ndjson');

const response = await fetch(`${c.env.CLOUDFLARE_API_URL}/accounts/${c.env.CLOUDFLARE_ACCOUNT_ID}/vectorize/indexes/${vectorize}/insert`, {
method: 'POST',
headers: {
Authorization: `Bearer ${c.env.CLOUDFLARE_API_TOKEN}`,
},
body: formData,
});
const blob = new Blob([JSON.stringify({ id, values }) + '\n'], { type: 'application/x-ndjson' });
console.log('blob :', blob);
const formData = new FormData();
formData.append('file', blob, 'data.ndjson');

const response = await fetch(`${c.env.CLOUDFLARE_API_URL}/accounts/${c.env.CLOUDFLARE_ACCOUNT_ID}/vectorize/indexes/${vectorize}/insert`, {
method: 'POST',
headers: {
Authorization: `Bearer ${c.env.CLOUDFLARE_API_TOKEN}`,
},
body: formData,
});
Am I doing something wrong? Any ideas?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?