πŸ–Ό
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
1
package main
2
​
3
import (
4
"context"
5
"github.com/ctreminiom/go-atlassian/confluence"
6
"log"
7
"os"
8
)
9
​
10
func main() {
11
​
12
var (
13
host = os.Getenv("HOST")
14
mail = os.Getenv("MAIL")
15
token = os.Getenv("TOKEN")
16
)
17
​
18
instance, err := confluence.New(nil, host)
19
if err != nil {
20
log.Fatal(err)
21
}
22
​
23
instance.Auth.SetBasicAuth(mail, token)
24
instance.Auth.SetUserAgent("curl/7.54.0")
25
​
26
​
27
tasks, response, err := instance.LongTask.Gets(context.Background(), 0, 50)
28
if err != nil {
29
if response != nil {
30
log.Println("Response HTTP Response", response.Bytes.String())
31
}
32
log.Fatal(err)
33
}
34
​
35
log.Println("Endpoint:", response.Endpoint)
36
log.Println("Status Code:", response.Code)
37
​
38
for _, task := range tasks.Results {
39
log.Println(task)
40
}
41
}
42
​
Copied!

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
1
package main
2
​
3
import (
4
"context"
5
"github.com/ctreminiom/go-atlassian/confluence"
6
"log"
7
"os"
8
)
9
​
10
func main() {
11
​
12
var (
13
host = os.Getenv("HOST")
14
mail = os.Getenv("MAIL")
15
token = os.Getenv("TOKEN")
16
)
17
​
18
instance, err := confluence.New(nil, host)
19
if err != nil {
20
log.Fatal(err)
21
}
22
​
23
instance.Auth.SetBasicAuth(mail, token)
24
instance.Auth.SetUserAgent("curl/7.54.0")
25
​
26
task, response, err := instance.LongTask.Get(context.Background(), "195690524")
27
if err != nil {
28
if response != nil {
29
log.Println("Response HTTP Response", response.Bytes.String())
30
}
31
log.Fatal(err)
32
}
33
​
34
log.Println("Endpoint:", response.Endpoint)
35
log.Println("Status Code:", response.Code)
36
​
37
log.Println(task)
38
}
39
​
Copied!
Export as PDF
Copy link