Monday API version 2024 - updating gql

Error: “errors”:[{“extensions”:{“argumentName”:“column_values”,“code”:“variableMismatch”,“errorMessage”:“List dimension mismatch”,“typeName”:“String!”,“variableName”:“value”}

Here is my code snippet - I am trying to migrate my existing code to the new api.

const getItemId = async (payload) => {
  const { board_id, column, value } = payload;

  const query = gql`
    query GetItems($board_id: ID!, $column: String!, $value: String!) {
      items_page_by_column_values(limit: 50, board_id: $board_id, columns:[{column_id: $column, column_values: $value}]) {
        id
      }
    }
  `;

  const variables = {
    board_id,
    column,
    value,
  };

  const { data } = await mondayApi.post('', { query, variables });
  logger.info({
    function: 'getItemId',
    message: 'Get item id - Monday',
    data,
  });

  return data?.data?.items_page_by_column_values?.[0]?.id;
};

Hello there @frankie,

It looks like it is probably an issue with the data you are passing as variables. I just tried this and it worked well:

query GetItems($board_id: ID!, $column: String!, $date: String!) {
      items_page_by_column_values(limit: 50, board_id: $board_id, columns:[{column_id: $column, column_values: [$date]}]) {
        items{
          id
        }
      }
    }
{
  "board_id": 1234567890,
  "date": "2024-01-01",
  "column": "date4"
}

I hope that helps!

Cheers,
Matias