
๐Metadata
Get create metadata issue types for a project
package main
import (
"context"
"fmt"
"github.com/ctreminiom/go-atlassian/v2/jira/v2"
"log"
)
func main() {
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
atlassian, err := v2.New(nil, host)
if err != nil {
return
}
atlassian.Auth.SetBasicAuth(mail, token)
issueTypeMappings, response, err := atlassian.Issue.Metadata.FetchIssueMappings(context.Background(), "KP", 0, 50)
if err != nil {
log.Println(response.Bytes.String())
log.Fatal(err)
}
fmt.Println(response.Endpoint)
for _, issueType := range issueTypeMappings.Get("issueTypes").Array() {
/*
{
"description": "An error in the code",
"iconUrl": "https://your-domain.atlassian.net/images/icons/issuetypes/bug.png",
"id": "1",
"name": "Bug",
"self": "https://your-domain.atlassian.net/rest/api/3/issueType/1",
"subtask": false
}
*/
fmt.Println(issueType.Get("description").String())
fmt.Println(issueType.Get("iconUrl").String())
fmt.Println(issueType.Get("id").String())
fmt.Println(issueType.Get("name").String())
fmt.Println(issueType.Get("self").String())
fmt.Println(issueType.Get("subtask").Bool())
fmt.Println("------------")
}
}Get create field metadata for a project and issue type id
Get Edit Issue Metadata
Get Create Issue Metadata
Last updated
Was this helpful?