⚙

Server

This resource provides information about the Jira instance.

Get Jira instance info

Returns information about the Jira instance.
package main
​
import (
"context"
"github.com/ctreminiom/go-atlassian/jira/v2"
"log"
"os"
)
​
func main() {
​
/*
----------- Set an environment variable in git bash -----------
export HOST="https://ctreminiom.atlassian.net/"
export MAIL="MAIL_ADDRESS"
export TOKEN="TOKEN_API"
​
Docs: https://stackoverflow.com/questions/34169721/set-an-environment-variable-in-git-bash
*/
​
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
​
atlassian, err := v2.New(nil, host)
if err != nil {
log.Fatal(err)
}
​
atlassian.Auth.SetBasicAuth(mail, token)
​
info, response, err := atlassian.Server.Info(context.Background())
if err != nil {
log.Fatal(err)
}
​
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
log.Println(info)
}