Error - Column Names - create new items (PHP)

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.

That looks like an escaping problem. Haven’t done PHP in a while, but I think this should be:

"{
\"Status\":\"done\",
\"Assignee\":\"Jon.Doe@gmail.com\"	
}"

Thank you @kioleanu but the status and assignee were empty. The item name appeared and the item was created. This time there was no error.

The output was:

{"data":{"create_item":{"id":"859429780"}},"account_id":XXXXXXXX}

Partial code for the columns. Note: I tried switching Status with Priority - but only the item name appears. The Priority and Assignee are empty.

$query = 'mutation ($myItemName: String!) { create_item (board_id:564704604, item_name:$myItemName, column_values:
"{
\"Priority\":\"High\",
\"Assignee\":\"Jane\"	
}"

){ id } }';
$vars = ['myItemName' => 'Hello world2!'];

Note 2: The name of the assignee is the actual user-name. I tried both e-mail and name - none showed up. My assumption is that it is due to the query. It must be a syntax error I cannot see.

Hey there!

Is the assignee column a people column? If so, you’ll need to send a comma-separated list of the user IDs of the people you want to assign to the board.

For an example of this, check out our documentation here: Updating a people column

I hope that helps :slight_smile: