Hey All,
New here to the community and have been playing around with your " API Quickstart Tutorial - PHP". I have been able to get pretty far playing around with things I need but I have come up with a stumbling block and all of my searching in the community I can’t seem to find anything so here I am!
I went ahead and did a copy and paste of your " Creating a new item using GraphQL variables" section and it worked great in my board but that was for the item name. How can I put a variable into a column_value value?
Here’s the code (with token and everything after $responseContent = removed):
$apiUrl = ‘https://api.monday.com/v2’;
$headers = [‘Content-Type: application/json’, 'Authorization: ’ . $token];
$marketing = “Package A ($150)”;
$query = ‘mutation ($myItemName: String!) { create_item (board_id:My Board_ID, item_name:$myItemName, column_values : “{"title":$myItemName}”) { id } }’;
$vars = [‘myItemName’ => $marketing];
$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);
Any help or pointing me in the right direction is greatly appreciated!