I’d check the structure of the headers. There looks to be misplaced quotes, and the 2024-01 is a string value - so my instincts say it would be quoted would it not?
Hello there @rcullen;
I also think the structure of the headers could be the issue here.
Here is an example I created using Postman:
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.monday.com/v2/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'APITOKENHERE',
'API-version' => '2024-01',
'Content-Type' => 'application/json'
));
$request->setBody('{"query":"mutation {\\\\n change_simple_column_value (item_id:9876543210, board_id:1234567890, column_id:\\\\"long_text\\\\", value: \\\\"Sample text\\\\") {\\\\n id\\\\n }\\\\n}","variables":{}}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Thank you Matias, I will try this out.