Hi,
While trying to use the GraphQL in Node.js for add_file_to_column in the mutation mode, I’m getting an error of Unsupported query, no matter what.
The code is exactly the same as the request in the Postman, which works properly.
Please try to advise:
const formData = new FormData();
formData.append(
'variables[file]',
fs.createReadStream(
'Path to file'
)
);
formData.append(
'query',
'mutation ($file: File!) {add_file_to_column (file: $file, item_id: XXXX, column_id: "files") {id}}');
fetch('https://api.monday.com/v2/file', {
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
Authorization: MONDAY_API_KEY,
},
body: formData,
}) .then((res) => res.json())
.then((res) => {
console.log(JSON.stringify(res, null, 2));
})
.catch((err) => {
console.log(err);
});