Skip to main content

Hi,


I am trying to use the graphql API to add a file to a column. The query seems to work as I receive an asset ID in the response, but I don’t see the file in the item/column when I go on Monday.com. Furthermore when I query the asset to get the url and open it in my browser I see the following error : “SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data”.


Here is the request I am doing:


curl --location --request POST 'https://api.monday.com/v2/file' \\
--header 'Authorization: SecretKey' \\
--form 'query="mutation add_file($file: File!, $item_id: Int!, $column_id: String!) {add_file_to_column (item_id: $item_id, column_id: $column_id, file: $file) {id}}"' \\
--form 'variables="{\\"item_id\\":2286426338, \\"column_id\\": \\"files\\"}"' \\
--form 'map="{\\"image\\":\\"variables.file\\"}"' \\
--form 'image=@"/home/gdacier/Documents/Myphoto.jpg"'

Note that when I try to add the same file to an udpate using add_file_to_update it works :


curl --location --request POST 'https://api.monday.com/v2/file' \\
--header 'Authorization: SecretKey \\
--form 'query="mutation add_file($file: File!, $update_id: Int!) {add_file_to_update(update_id: $update_id, file: $file) {id}}"' \\
--form 'variables="{\\"update_id\\":1364498421}"' \\
--form 'map="{\\"image\\":\\"variables.file\\"}"' \\
--form 'image=@"/home/gdacier/Documents/Myphoto.jpg"'

Hello @gdacier and welcome to the community!


I hope you like it here 🙂


I am sorry for the late reply 🙃


This looks like a very specific issue, could you please send us an email to appsupport@monday.com so we can take a closer look into this issue?


Looking forward to hearing from you!


Cheers,

Matias


Reply