Parse error with create_item and column_values

Hi @robdodson, Here’s an example of how to pass values to columns using the fetch api, hope this makes it more clear

const body = {
  query: `
	mutation ($boardId: Int!, $groupId: String!, $itemName: String!, $columnValues: JSON!) {
	  create_item (
	    board_id: $boardId,
	    group_id: $groupId,
	    item_name: $itemName,
	    column_values: $columnValues
	  ) {
	    id
	  }
	}
  `,
  variables: {
  	boardId: MY_BOARD_ID,
	groupId: "topics",
	itemName: "New item name",
	columnValues: JSON.stringify({ check: { checked: "true" } })
  }
}

return fetch('http://api.monday.com/v2/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': process.env.MONDAY_TOKEN,
    },
    body: JSON.stringify(body),
  })
  .then(response => response.json());
2 Likes