Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

request failed. Please analyze the request body for more details. Status code: 400

Sriharsha M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2023
func jiraCreateHandler(response http.ResponseWriter, request *http.Request) {
    contextVal := GetSessionContext()
    base := "https://myjira.com/jira"
   
    tp := jira.BasicAuthTransport{
       
        Username: "sriharsha.m@XXX.com",
              Password:"NjkyMzgxMjk3N0OjR1jTOhRZLLra68Dz7DNGq96LBP",
    }
    jiraClient, err := jira.NewClient(tp.Client(), base)
    if err != nil {
        fmt.Println("error at creating an new instance client")
        panic(err)
    }
    i := jira.Issue{
        Fields: &jira.IssueFields{
            Assignee: &jira.User{
                Name: "msri",
            },
            Reporter: &jira.User{
                Name: "msri",
            },
            Description: "Test Issue",
            Type: jira.IssueType{
                Name: "Bug",
            },
            Project: jira.Project{
                Key: "RSA",
            },
            Summary: "Just a demo issue",
        },
    }

 

    issue, response1, err := jiraClient.Issue.Create(&i)
    fmt.Printf("response1", response1.Body)
    if err != nil {
        fmt.Println("error at creating an Issue")
        panic(err)
    }

 

    fmt.Printf("%s: %+v\n", issue.Key, issue.Fields.Summary)

1 answer

0 votes
Sriharsha M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2023

how to pass custom mandatory fields ???? 

like 


             Component/s: "Default",
            Affects Version/s:"1_1_0_1_0",

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events