I’ve been working with Monday for about a week now, and I swear this exact code was working a few days ago. But now the response I get is “No query string was present”. I checked and rechecked the api key, board id, column ids, etc.
$headers = [
"Content-Type: application/json",
"Authorization: $apiKey",
"API-Version: 2023-10" //brand new as of January 2024
];
$url = "https://api.monday.com/v2";
$method = "POST";
$boardID = $boardID;
$query = 'mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id: ' . $boardID . ', item_name:$myItemName, column_values:$columnVals) { id } }';
$vars = ['myItemName' => "JOHN DOE",
'columnVals' => json_encode([
'contact_phone' => $phone,
'countryShortName' => 'US', //an attempt to get the US flag to show up
'text0' => "#DA"
])];
$ch = curl_init();
$je = json_encode(['query' => $query, 'variables' => $vars]);
$jd = json_decode($je);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $je);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
pulling out A hair ties (also called a ponytail holder, hair band, hair elastic, wrap around, gogo, or bobble) is an item used to fasten hair, particularly long hair, away from areas such as the face.