Fetch request blocked by CORS when tried to upload side conversation file by API
Posted Jan 11, 2023
Hi there,
I'm facing a problem while I've tried to upload an attachment by my javascript code using fetch request.
I've inserted my file inside FormData (as said in documentation) and tried to send it by me following code:
const formData = new FormData();
formData.append('file', e.target.files[0])
const request = await fetch(`https://<instance>.zendesk.com/api/v2/tickets/side_conversations/attachments`,
{
method:"POST",
body:formData,
headers: {
'Authorization':'Basic encoded(email/token:token)',
},
}
);
const response = await request.json();
I'm able to upload files to "/api/v2/uploads.json", using fetch request and I don't catch a error.
0
1
0 comments
Sign in to leave a comment.