Creating an item is not an issue.
Adding column items (Status and Assignee) results in errors namely:
{"errors":[{"message":"Parse error on \\":\\" (STRING) at [3, 11]","locations":[{"line":3,"column":11}]}],"account_id":1157581}
The code:
$token = 'TOKEN HIDDEN - PUBLIC FORUM';
$apiUrl = 'https://api.monday.com/v2';
$headers = ['Content-Type: application/json', 'Authorization: ' . $token];
$query = 'mutation ($myItemName: String!) { create_item (board_id:564704604, item_name:$myItemName, column_values:
"{
"Status":"done",
"Assignee":"Jon.Doe@gmail.com"
}"
$data = @file_get_contents($apiUrl, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $headers,
'content' => json_encode(['query' => $query, 'variables' => $vars]),
]
]));
$responseContent = json_decode($data, true);
echo json_encode($responseContent);
The error seems to be in the way I add the Columns. I have seen other posts mentioning adding slashes - others mention using a column ID (I don’t know where to find the ID). Can someone please help in fixing the above code? Thanks.