βš™
Server
This resource provides information about the Jira instance.

Get Jira instance info

Returns information about the Jira instance.
1
package main
2
​
3
import (
4
"context"
5
"github.com/ctreminiom/go-atlassian/jira/v2"
6
"log"
7
"os"
8
)
9
​
10
func main() {
11
​
12
/*
13
----------- Set an environment variable in git bash -----------
14
export HOST="https://ctreminiom.atlassian.net/"
15
export MAIL="MAIL_ADDRESS"
16
export TOKEN="TOKEN_API"
17
​
18
Docs: https://stackoverflow.com/questions/34169721/set-an-environment-variable-in-git-bash
19
*/
20
​
21
var (
22
host = os.Getenv("HOST")
23
mail = os.Getenv("MAIL")
24
token = os.Getenv("TOKEN")
25
)
26
​
27
atlassian, err := v2.New(nil, host)
28
if err != nil {
29
log.Fatal(err)
30
}
31
​
32
atlassian.Auth.SetBasicAuth(mail, token)
33
​
34
info, response, err := atlassian.Server.Info(context.Background())
35
if err != nil {
36
log.Fatal(err)
37
}
38
​
39
log.Println("Response HTTP Code", response.Code)
40
log.Println("HTTP Endpoint Used", response.Endpoint)
41
log.Println(info)
42
}
Copied!
Export as PDF
Copy link