Hi @taewoo.Oh
The content-type header is not required, you can try removing 'Content-Type': 'text/plain'
from your script.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hello,
I want to use the upload API in Graph REST API.
I set Content-Type: text/plain according to the official document, but an error like the picture occurs. Does anyone know why?
This is the code I wrote. Is there a problem with your code?
async _createUrlFile(){
const url = `[InternetShortcut]
URL =`+ this.userValue;
console.log(url);
const blobFile = new Blob([url],{type: 'text/plain'});
console.log(blobFile);
let res = await fetch('https://graph.microsoft.com/v1.0/drives/01TMG2GIK5NDAVZY67M5BIFFZHNASXBVBY/items/01TMG2GIKC7HQGCO7RGBEZCQKDPLQ4G7NG/testFile.url:/content',{
method : "PUT",
headers:{
'Authorization': 'Bearer ' + this.TOKEN,
'Content-Type': 'text/plain'
},
body : {
blobFile
}
})
const data = await res.json();
console.log(data);
};
Hi @taewoo.Oh
The content-type header is not required, you can try removing 'Content-Type': 'text/plain'
from your script.