Adding an image to an item is problematic

I am able to create an item without trouble if I do not reference the item files column and I get back the new item ID and save that for future use.

I have the URL to an image, fully qualified, as in https://cdn.mysource.com/foo.jpg

The board has a column of type file with an ID files and therefore I want this image to be assigned to it. No matter what I do though, Monday returns

{"error_message"=>"Internal server error", "status_code"=>500}

When I include the column with the image, files: image, the image string URL the create fails.

Why??? I tried the mutation with the item_id and column_id and providing the id of the items file column, same deal.

 mutation($item_id: Int!, $file: File!) {
      add_file_to_column (item_id: $item_id, column_id: "files", file: $file) {
        id
      }
    }

How can I create an item with an image using Monday API? What is the secret?

Please!

Hello there @dlazar,

That mutation is a multi-part POST request that requires a file from your computer to be used. You can not use a link for it.

You can find an example on how the mutation is used here.

Let me know if you have any questions :slightly_smiling_face:

Cheers,
Matias

1 Like

Yes. I got it working with the clunky multipart post. I guess seeing as in 2021 this was a recognized problem, in that the API was not advanced enough to handle file links, it remains the same in 2023. OK. Moving on! I do hope that at some point things get simplified enough where we can just provide a link.

Thanks for confirming IRL behaviour for me today!