Mirrors Columns and API New Versions

Hi!

I am updating my codes considering the new version of the API. However, something very odd happened. Versions 2023-10 and 2024-01 did not load any data in mirror columns for the boards:

5087161303

5074524960

5082043087

5074430711

5074427222

5124516984

5124256345

5124251433

5124243595

5124213277

5123837747

4988499062

5124220711

5087402995

5074527029

5082045015

5074431667

5074428913

5096754394

5096743547

5096751022

5096733887

4993087356

My domain on Monday is http://fractaledu.monday.com/.

It tried to retrieve data using the value field, however, this dimension was null too.

Version 2023-07 is retrieving data normally, but I know that column_values_v1 will be deprecated. So, this is why I am very worried about this.

Here is an example of one of my queries: {“query”: “{ items (ids: 5208402082 ) { id name column_values { column { title } text } } } }”}

Thanks for your support.

1 Like

The text field is no longer populated for mirror columns.

However, see the docs for the new API… Mirror

column_values v2 uses fragments for the different column types which can return more data. In this case, with ... on MirrorValue{display_value} returns a text string of the values like the older text value. The reason for this, is it no longer has to lookup the text value of all connected items if the developer doesn’t need it.

The fragment only executes on MirrorValues. So if you only include id inside the fragment, id only gets returned for mirror columns.

You can have many fragment types in one query that will only execute on their respective types. Anything outside of fragments (or in a ... on ColumnValue fragment) will always execute. (ColumnValue is the base type for all other value types).

query {
  items (ids:[1234567890, 9876543210]) {
    column_values {
      ... on MirrorValue {
        id
        display_value
      }
    }
  }
}

All column types have a V2 fragment that can provide detail that the old v1 value property never included.

1 Like

Thanks.

I read the documentation and I did not understand this situation. However, considereing the field value, is it correct that it came empty?

1 Like

Yes it should be empty for mirror columns.

You can get mirror values using the ... on MirrorValue{display_value} inside column_values as I showed, mirror columns will return their value then as “display_value”. You will also want to include the column type in the query to see if it is a mirror so you can account for reading the alternate field.

1 Like

Thank you @codyfrisch !!!

1 Like

Great, thanks again!

I believe that If I use the value outside the MirrorValue, the API will send me the JSON, but after your message and reading the documentation, I believe this will happen only if I put it inside.

1 Like

Even the value field will be returned as null. As it stands in 2023-07 the value field is always null on mirrors, and only text ever has anything.

In 2023-10, text is now also always null, and you must use the ... on MirrorValue{display_value} to get what used to be in the text field in 2023-07.

In 2023-10, ... on MirrorValue{value} will still return null for value - as value has always been null on mirror columns.

I typically have a function that I call on the item.column_values that is something like this:

items.forEach((item) => {
 item.column_values.forEach((cv) => {
   if (cv.type != "mirror") return;
   cv.text = cv.display_value;
 }
}

This way for processing farther down the pipeline, everything is in text and I don’t have to put if statements throughout everything to check for mirror column.

2 Likes