Skip to main content

How to remove / delete file from item via API

  • October 18, 2021
  • 8 replies
  • 2943 views

Hello,

I can upload file from API with GraphQL (“mutation add_file”); however, I cannot update or remove file from item. Is there any endpoint to update/delete file from related column of board item.

Thanks.

Turan

This topic has been closed for replies.

8 replies

andrew.shatz
  • Participating Frequently
  • October 18, 2021

Hello Turan,

I believe the way to do this is by updating the column value for your particular file column using the {“clear_all”: true} value.

Please note that this will remove all files from the item’s column value, as the feature to remove individual items is not available. I have provided a link below to where the documentation highlights the available functionality. I believe that you may find your solution down at the very bottom with Removing Column Values.

https://api.developer.monday.com/docs/change-column-values#removing-column-values

Please let us know if this works for you.

Thank you and happy coding!

Andrew


AlexSavchuk
Forum|alt.badge.img
  • monday.com Team Member
  • October 19, 2021

Hey @tgurler 👋

I agree with @andrew.shatz’s great response here! You will not be able to remove a single file from the File column at this time, and you’d need to resort to removing all files at once as of right now.

Let us know if this would work for you - otherwise, we could change this topic into a feature request 🙂

-Alex


  • Author
  • Participating Frequently
  • October 19, 2021

Thanks for the answer, I tried this query but it did not make any update; did I miss anything?

mutation { change_simple_column_value (board_id: 1803949189, item_id: 1803949221, column_id: "files", clear_all: "true") { id } }

@AlexSavchuk the feature that removes all files covers our requirement but if there is a feature to remove specific file by asset id or something, it will be useful; because users can upload their own files; but if we can remove only files that are uploaded by API will be useful.

Thanks.


  • Author
  • Participating Frequently
  • October 19, 2021

Btw, when I use this:

query: mutation { change_column_value (board_id: 1803949189, item_id: 1803949221, column_id: "files", value: "", clear_all: "true") { id } }

I got this response:
response: {"error_message":"Internal server error","status_code":500}


andrew.shatz
  • Participating Frequently
  • October 19, 2021

Hello Turan,

You are getting that error because you need to set the value in your request as the serialized json of the {“clear_all”: true} object. A correction is shown below.

mutation { change_column_value (item_id: 1803949221, column_id:"files", board_id: 1803949189, value:"{\\\\"clear_all\\\\": true}") { id } }

Please let us know if this works for you.

Thanks!


AlexSavchuk
Forum|alt.badge.img
  • monday.com Team Member
  • October 20, 2021

Amazing as always, @andrew.shatz !

@tgurler, please let us know if you are still having issues with this, or if Andrew’s suggestion helped 🙂

-Alex


  • Author
  • Participating Frequently
  • October 20, 2021

It works now great. Thank you all 🙂


  • October 27, 2021

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.