I have now resolved this issue using the bulk/execute endpoint as follows with the following request in case anybody else stumbles across the same issue as it took me a few hours to figure this out...
foreach($data as $ts) {
$id = $ts['external_id'] //The External Reference from Clarizen TS
$params['requests'][] = [
'url' => "/data/changeState",
'method' => 'POST',
'body' => [
'Ids' => ["/Timesheet/{$id}"],
'state' => '{YOUR_REQUIRED_STATE}'
],
];
}
$this->clarizen = $this->curl_request('/bulk/execute', $params, 'post', $session, $server_details['serverLocation']);
$this->clarizen = json_decode($this->clarizen, true);
foreach($this->clarizen['responses'] as $message) {
if($message['statusCode'] != 200) {
$errors[] = $message['body']['message'];
}
}
if(!empty($errors)) {
var_dump($errors); //There will be multiple requests with potentially different errors, log them all.
exit(1);
}