Skip to main content

How do I find the files attached to an item in graphql?

  • October 4, 2024
  • 4 replies
  • 34 views

dvdsmpsn
Forum|alt.badge.img+1
  • Participating Frequently
  • 425 replies

I have this item, or rather subitem (with a file attached):

The file is not in a column, or a status, so I don’t seem to be able to locate it using graphql:

  • How can I find it with graphql?
  • Where am I going wrong?

4 replies

  • Participating Frequently
  • 948 replies
  • October 5, 2024
monday.com Platform API

See the asset_source argument. You need to add that with gallery or all as the default is columns apparently. Note its an enum, not string so no quotes.

{
  items(ids: "123145234") {
    assets(assets_source: gallery) {
      id
      name
    }
  }
}
``

dvdsmpsn
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • 425 replies
  • October 5, 2024

Thanks @anon29275264 thats weird, so all is what I need. 🤞


  • Participating Frequently
  • 948 replies
  • October 5, 2024

presuming you want gallery and columns. assets also has an argument for a files column that will restrict it to a particular column


dvdsmpsn
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • 425 replies
  • October 7, 2024

Regarding this:

assets_source will take values of all, columns or gallery, but not updates.

That’s somewhat weird, but I guess that columns & gallery must somehow be more strongly connected to an item, whereas an update is somehow seen as more of a separate entity.

If there is some logic behind this, I’d love to know.

To get a full list of all assets attached to an item, you’ll therefore need the following:

{
  items(ids: "123145234") {
    assets(assets_source: all) {
      id
      name
    }
    updates {
      assets {
        id
        name
      }
    }
  }
}