Monday API version 2024

My error message : ‘Type mismatch on variable $board_id and argument board_id (Int! / ID!)’

const createItem = async (payload) => {
  const { board_id, item_name, column_values } = payload;

  const query = gql`
    mutation CreateItem($board_id: Int!, $item_name: String!, $column_values: JSON!) {
      create_item(board_id: $board_id, item_name: $item_name, column_values: $column_values) {
        id
      }
    }
  `;

  const variables = {
    board_id,
    item_name,
    column_values: JSON.stringify(column_values),
  };

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

  return data.create_item;
};

Hi @frankie,

Welcome to the community!

Your board_id should be type ID! instead of Int! (see more here) :slight_smile:

Best,
Rachel

1 Like

Thank you! I cant believe i missed that!

You are the best @rachelatmonday <3

1 Like

Hi Rachel can i bother you one more time?

Hi there @frankie ! I replied in the other message!