๐Ÿ–ผ
Long Task

Get long-running tasks

Returns information about all active long-running tasks (e.g. space export), such as how long each task has been running and the percentage of each task that has completed.
The Confluence Cloud REST API
Official Documentation
package main
โ€‹
import (
"context"
"github.com/ctreminiom/go-atlassian/confluence"
"log"
"os"
)
โ€‹
func main() {
โ€‹
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
โ€‹
instance, err := confluence.New(nil, host)
if err != nil {
log.Fatal(err)
}
โ€‹
instance.Auth.SetBasicAuth(mail, token)
instance.Auth.SetUserAgent("curl/7.54.0")
โ€‹
โ€‹
tasks, response, err := instance.LongTask.Gets(context.Background(), 0, 50)
if err != nil {
if response != nil {
log.Println("Response HTTP Response", response.Bytes.String())
}
log.Fatal(err)
}
โ€‹
log.Println("Endpoint:", response.Endpoint)
log.Println("Status Code:", response.Code)
โ€‹
for _, task := range tasks.Results {
log.Println(task)
}
}
โ€‹

Get long-running task

Returns information about an active long-running task (e.g. space export), such as how long it has been running and the percentage of the task that has completed.
The Confluence Cloud REST API
Official Documentation
package main
โ€‹
import (
"context"
"github.com/ctreminiom/go-atlassian/confluence"
"log"
"os"
)
โ€‹
func main() {
โ€‹
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
โ€‹
instance, err := confluence.New(nil, host)
if err != nil {
log.Fatal(err)
}
โ€‹
instance.Auth.SetBasicAuth(mail, token)
instance.Auth.SetUserAgent("curl/7.54.0")
โ€‹
task, response, err := instance.LongTask.Get(context.Background(), "195690524")
if err != nil {
if response != nil {
log.Println("Response HTTP Response", response.Bytes.String())
}
log.Fatal(err)
}
โ€‹
log.Println("Endpoint:", response.Endpoint)
log.Println("Status Code:", response.Code)
โ€‹
log.Println(task)
}
โ€‹
Export as PDF
Copy link
On this page
Get long-running tasks
Get long-running task