GET /rest/api/{2-3}/issue/createmeta/{projectIdOrKey}/issuetypes
FetchIssueMappings returns a page of issue type metadata for a specified project. Use the information to populate the requests in Create issue and Create issues. This operation can be accessed anonymously.
Get create field metadata for a project and issue type id
GET /rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}
Returns a page of field metadata for a specified project and issuetype id. Use the information to populate the requests in Create issue and Create issues. This operation can be accessed anonymously.
Returns the edit screen fields for an issue that are visible to and editable by the user. Use the information to populate the requests in Edit issue.
package main
import (
"context"
"fmt"
v2 "github.com/ctreminiom/go-atlassian/jira/v2"
"log"
"os"
)
func main() {
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)
metadata, response, err := atlassian.Issue.Metadata.Get(context.Background(), "KP-1", false, false)
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Endpoint Used", response.Endpoint)
fields, response, err := atlassian.Issue.Field.Gets(context.Background())
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Endpoint Used", response.Endpoint)
for _, field := range fields {
path := fmt.Sprintf("fields.%v.required", field.ID)
value := metadata.Get(path)
if value.Exists() {
fmt.Println("Field Name:", field.Name, "Required?:", value.String())
}
}
}
Get Create Issue Metadata
GET /rest/api/{2-3}/issue/createmeta
Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user. Use the information to populate the requests in Create issue and Create issues.