andygrunwald / andygrunwald/go-jira

Issue Creation Failed --: Request failed. Please analyze the request body for more details. Status code: 400

Đang mở
#437 8 bình luận 2 reaction 0 người được giao Xem trên GitHub
needs triage
Ngôn ngữ chính
Go
Star
1.6k
Fork
500
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I am able to successfully connect to My JIRA cloud and pulled in the details of an issue even transition is also happening of existing tickets. I am trying to just create a new issue with the example provided (https://github.com/andygrunwald/go-jira/blob/master/examples/create/main.go) but it's failing with the error: ```2022/02/06 21:38:47 request failed. Please analyze the request body for more details. Status code: 400```.

Here is the code I am using:

```
package main

import (
"log"
"os"
"fmt"
"github.com/joho/godotenv"
jira "github.com/andygrunwald/go-jira"
)

func main() {
// Load the .env file
godotenv.Load(".env")
// Create a BasicAuth Transport object
tp := jira.BasicAuthTransport{
Username: os.Getenv("JIRA_USER"),
Password: os.Getenv("JIRA_TOKEN"),
}
// Create a new Jira Client
client, err := jira.NewClient(tp.Client(), os.Getenv("JIRA_URL"))
if err != nil {
log.Fatal(err)
}
i := jira.Issue{
Fields: &jira.IssueFields{
Assignee: &jira.User{
Name: "myuser@domain.com",
},
Reporter: &jira.User{
Name: os.Getenv("JIRA_USER"),
},
Description: "Test Issue",
Type: jira.IssueType{
Name: "Task",
},
Project: jira.Project{
Key: "Infra",
},
Summary: "Just a demo issue",
},
}
createIssue, _, err := client.Issue.Create(&i)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s: %+v\n", createIssue.Key, createIssue.Fields.Summary)
}
```

I receive the following error every time
```2022/02/06 21:38:47 request failed. Please analyze the request body for more details. Status code: 400```
My JIRA_USER account has administrator privileges. I am using JIRA cloud.

Could you give me a good example or assist me on this? Also possible to get any user's ccountID with this module??

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.