Skip to main content

List dimension mismatch on variable $id and argument item_id ([ID!] / ID)

  • December 6, 2023
  • 2 replies
  • 414 views

I’m trying to run this code to update column values on an existing item by its ID, but I’m getting this error:

List dimension mismatch on variable $id and argument item_id ([ID!] / ID)

My ID is an INT so not sure what I’m doing wrong here.

 $id = 5543373657
 $new_service_level = "Digital";
 $new_monthly_rate = "$250";

 $query = 'mutation ($id: [ID!], $columnVals: JSON!) { change_multiple_column_values (board_id:XXXXXXX, item_id:$id, column_values:$columnVals) { id } }';

$vars = [
  'id' => $id,
  'columnVals' => json_encode([
	'status' => ['label' => $new_service_level], //Service Level
	'text17' => $new_monthly_rate //Monthly Bill Rate
])];

 $data = @file_get_contents($apiUrl, false, stream_context_create([
 'http' => [
 'method' => 'POST',
 'header' => $headers,
 'content' => json_encode(['query' => $query, 'variables' => $vars]),
 ]
]));

$tempContents = json_decode($data, true);

2 replies

  • Author
  • Participating Frequently
  • December 6, 2023

I fixed this by changing my code to:

$query = 'mutation ($id: ID!, $columnVals: JSON!) { change_multiple_column_values (board_id:XXXXXXX, item_id:$id, column_values:$columnVals) { id } }';

Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • December 7, 2023

Hello there @adouglas_ivet I am glad you found the source of the issue 😁