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

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);

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 } }';
2 Likes

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