Current state-of-the-art generative AI was supposed to be able to give me straight answer for this. But ChatGPT and Deepseek kept giving me wrong answers and wasting even more of my time going back and forth than if I had just read the damn documentation myself.
So here is the straight answer from me, a human being, on how to update a specific Cloudflare KV pair along with updated metadata:
const url = `https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/storage/kv/namespaces/<NAMESPACE_ID>/values/<KV_KEY>`;
const formData = new FormData();
formData.append('value', <KV_VALUE>);
formData.append('metadata', JSON.stringify(<KV_METADATA_OBJ>));
const response = await fetch(url, {
method: 'PUT',
headers: {
Authorization: `Bearer <API_TOKEN>`,
},
body: formData,
});
const result = await response.json();
console.log(result);
Conclusion
Still no way I'm trusting 'AI'. They don't know what they are doing. GenAI won't get us to AGI and all that. We are doing AI wrong. Also check out my website to discover best movies from Wikipedia nobody else is recommending. That's all. Cheers.
Top comments (0)