-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorder API has Changed? #6830
Comments
@gnilebein As far as I know, the Rest API endpoints did not change. Please share system info and error messages. |
Thank you very much for your answer.. I was able to solve the problem myself by adapting my script. I have used this script in the past to move overdue cards from one stack to another. <?php
// Dieses Script verschiebt Karten aus einem Stack "Warten" in einen anderen Stack, wenn das DueDate überschritten wurde.
// Es unterstützt mehrere Boards.
$boards = [
["id" => 6, "source" => 20, "destination" => 10]
];
$username = "USER";
$password = "PASSWORD";
// Funktion zum Senden von cURL-Requests
function sendCurlRequest($url, $method = "GET", $data = null)
{
global $username, $password;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'OCS-APIRequest: true',
'Authorization: Basic ' . base64_encode($username . ":" . $password)
]);
if ($method !== "GET") {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
if ($data !== null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
}
}
$response = curl_exec($ch);
if ($response === false) {
error_log("cURL-Fehler: " . curl_error($ch));
}
curl_close($ch);
return json_decode($response, true);
}
foreach ($boards as $board) {
$url = "https://nextcloud.gnilebein.de/index.php/apps/deck/api/v1.1/boards/{$board['id']}/stacks/{$board['source']}";
$cards = sendCurlRequest($url);
if (!isset($cards['cards'])) {
error_log("Fehler: Keine Karten gefunden für Board ID {$board['id']}");
continue;
}
$data = ["order" => 0, "stackId" => $board['destination']];
foreach ($cards['cards'] as $card) {
if ($card['overdue'] > 1) {
$moveUrl = "https://nextcloud.domain.tld/index.php/apps/deck/api/v1.1/boards/{$board['id']}/stacks/{$card['stackId']}/cards/{$card['id']}/reorder";
sendCurlRequest($moveUrl, "PUT", $data);
}
}
} So far it has worked to update the order and destination fields for the card. With this code, moving works again: foreach ($boards as $board) {
$url = "https://nextcloud.gnilebein.de/index.php/apps/deck/api/v1.1/boards/{$board['id']}/stacks/{$board['source']}";
$cards = sendCurlRequest($url);
if (!isset($cards['cards'])) {
error_log("Fehler: Keine Karten gefunden für Board ID {$board['id']}");
continue;
}
foreach ($cards['cards'] as $card) {
if ($card['overdue'] > 1) {
$card['order'] = 999;
$card['stackId'] = $board['destination'];
$moveUrl = "https://nextcloud.domain.tld/index.php/apps/deck/api/v1.1/boards/{$board['id']}/stacks/{$card['stackId']}/cards/{$card['id']}/reorder";
sendCurlRequest($moveUrl, "PUT", $card);
}
}
} |
Hi you mentioned it changed with the "current version". Did you update to NC 31 which upgrades deck to 1.15.0? I use that API as well and want to be on the lookout for it. |
I have a few scripts that automatically move Nextcloud Deck cards to another stack when overdue. These no longer work with the current version.
I use this endpoint as described in the API:
/boards/{boardId}/stacks/{stackId}/cards/{cardId}/reorder
In my opinion, this was also used for the web interface.
However, the web interface now uses this endpoint:
/cards/{cardId}/reorder as the endpoint.
Has the API changed here and the documentation has not been adapted?
The text was updated successfully, but these errors were encountered: