kanboard-api – Go-Client für die Kanboard JSON-RPC API

kanboard-api ist eine Go-Bibliothek für den Zugriff auf die Kanboard JSON-RPC API. Die Library bietet eine fluent, verkettbare API für die Integration von Kanboard in Go-Anwendungen.

Was ist Kanboard?

Kanboard ist eine beliebte Open-Source-Projektmanagement-Software mit Fokus auf die Kanban-Methode. Mit über 9.000 GitHub-Stars ist es eine der meistgenutzten Self-Hosted-Lösungen für Aufgabenverwaltung. Die Software ist schlank, schnell und lässt sich gut automatisieren.

Warum diese Library?

Ich nutze Kanboard täglich für meine Projektverwaltung und wollte Tasks automatisiert erstellen, verschieben und aktualisieren können – zum Beispiel aus Automatisierungsplattformen oder eigenen Tools heraus.

Installation

go get code.beautifulmachines.dev/jakoubek/kanboard-api

Authentifizierung

Die Library unterstützt zwei Authentifizierungsmethoden:

// API Token (empfohlen)
client := kanboard.NewClient("https://kanboard.example.com").
    WithAPIToken("your-api-token")

// Basic Auth
client := kanboard.NewClient("https://kanboard.example.com").
    WithBasicAuth("admin", "password")

Schnellstart

package main

import (
    "context"
    "fmt"
    "log"
    "time"

    kanboard "code.beautifulmachines.dev/jakoubek/kanboard-api"
)

func main() {
    ctx := context.Background()

    client := kanboard.NewClient("https://kanboard.example.com").
        WithAPIToken("your-api-token").
        WithTimeout(30 * time.Second)

    // Task mit der Fluent API erstellen
    task, err := client.Board(1).CreateTaskFromParams(ctx,
        kanboard.NewTask("Mein Task").
            WithDescription("Beschreibung").
            WithPriority(2).
            WithTags("urgent", "backend"))
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Task erstellt: %d\n", task.ID)
}

Fluent API

Die Fluent API ermöglicht verkettete, kontextbezogene Operationen:

// Board-Operationen
board := client.Board(projectID)
tasks, _ := board.GetTasks(ctx, kanboard.StatusActive)
columns, _ := board.GetColumns(ctx)

// Task-Operationen
task := client.Task(taskID)
task.Close(ctx)
task.MoveToNextColumn(ctx)
task.AddTag(ctx, "reviewed")
task.AddComment(ctx, userID, "Kommentar")

Task-Erstellung

Mit TaskParams lassen sich Tasks flexibel konfigurieren:

params := kanboard.NewTask("Task-Titel").
    WithDescription("Detaillierte Beschreibung").
    WithCategory(categoryID).
    WithOwner(userID).
    WithColor("red").
    WithPriority(3).
    WithDueDate(time.Now().Add(7 * 24 * time.Hour)).
    WithTags("feature", "v2.0").
    InColumn(columnID)

task, err := client.Board(projectID).CreateTaskFromParams(ctx, params)

Task-Bewegung

// Zur nächsten/vorherigen Spalte
client.Task(taskID).MoveToNextColumn(ctx)
client.Task(taskID).MoveToPreviousColumn(ctx)

// In bestimmte Spalte
client.Task(taskID).MoveToColumn(ctx, columnID)

// In anderes Projekt
client.Task(taskID).MoveToProject(ctx, newProjectID)

Fehlerbehandlung

Die Library bietet typisierte Fehler:

task, err := client.GetTask(ctx, taskID)
if err != nil {
    if kanboard.IsNotFound(err) {
        // Task nicht gefunden
    }
    if kanboard.IsUnauthorized(err) {
        // Authentifizierung fehlgeschlagen
    }
}

Thread-Sicherheit

Der Client ist thread-safe und kann von mehreren Goroutines parallel genutzt werden.

Links

Lizenz

MIT License – siehe LICENSE.

| Aktualisiert: 03.02.2026