I have migrated the Redmine version from 3.4.6 to 5.0.5 and I used to create a Redmine issue via the rest API, After migration author_id param is not working
I used the below code to create an issue
Before migration: It created an issue with dynamic author_id
After migration: It created an issue with the user’s ID that authenticates with the API. (author_id params not working)
<?php
// Redmine API endpoint for issues
$redmineUrl = 'https://live-url/issues.json';
$apiKey = 'XXXXXXXXXXXX';
// Issue data
$issueData = array(
'issue' => array(
'project_id' => 'xyz',
'subject' => 'Issue subject',
'description' => 'Issue description',
'tracker_id' => 'bug', // Tracker ID for the type of issue (e.g., bug, feature, task)
'status_id' => 'New', // Status ID for the initial status of the issue
'author_id' => '12',
'watcher_user_ids' => [70,16],
)
);
// Set up cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $redmineUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($issueData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'X-Redmine-API-Key: ' . $apiKey
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the request
$response = curl_exec($ch);
echo "<pre>";
print_r($response);
// Check for errors
if ($response === false) {
echo 'Error: ' . curl_error($ch);
} else {
echo 'Issue created successfully!';
}
// Close cURL
curl_close($ch);