Hi All,
I am trying to upload an image file to column using add_file_to_column mutation.
Using the monday.com documentation I tried the postman example and it is working fine. But I am facing problems while uploading the picture by react native app. It is giving me Interval server error 500.
I just want to know if add_file_to_column supports base64 format because when I select an image on the mobile app, it returns base64 format and when I try with that. the response is 500.
Here’s my code:
const base64Data = insuranceImages[0].data // base64 Data
const requestBody = {
query: `
mutation($file: File!) {
add_file_to_column(
item_id: 4479452645,
column_id: "files",
file: $file,
){
id
}
}
`,
variables: {
file: {
createReadStream : base64Data,
filename: insuranceImages[0].filename
}
}
};
fetch('https://api.monday.com/v2/file', {
method: 'POST',
body: JSON.stringify(requestBody),
headers: {
'Content-Type': 'multipart/form-data',
"Authorization": CONFIG.MONDAY_API_KEY,
},
})
.then((res) => {
console.log('res',res);
if (!res.ok) {
console.warn('not ok');
}})
.catch((error) => {
console.warn('error', error);
});