How do i modify the fields in a ticket and update using go-jira?

Kaushik Kampli May 11, 2022

I am trying to fetch the request, update some parameters such as labels, assignee etc and push the same ticket i.e update it?

How do i do that in golang?

3 answers

0 votes
Plinkington _
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!
October 19, 2023

Found my way here looking for an answer, ended up looking through the existing test cases.
I assume it's something like this you want to do?

 

func TestIssueService_Update(t *testing.T) {
setup()
defer teardown()
testMux.HandleFunc("/rest/api/2/issue/PROJ-9001", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodPut)
testRequestURL(t, r, "/rest/api/2/issue/PROJ-9001")

w.WriteHeader(http.StatusNoContent)
})

i := &Issue{
Key: "PROJ-9001",
Fields: &IssueFields{
Description: "example bug report",
},
}
issue, _, err := testClient.Issue.Update(context.Background(), i, nil)
if issue == nil {
t.Error("Expected issue. Issue is nil")
}
if err != nil {
t.Errorf("Error given: %s", err)
}
}
0 votes
Carlos Garcia Navarro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2022
Kaushik Kampli May 11, 2022

Yup No luck

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2022

Hi Kaushik - Welcome to the Atlassian Community!

I am not completely following what your need is. Can you provide more details about what you are trying to do? 

Kaushik Kampli May 11, 2022

I am trying to modify the ticket from slack using slash commands.

Using go for the Rest purposes.

So I just need a way to do PUT operation to update the ticket(SLA, assignee, labels) etc

Suggest an answer

Log in or Sign up to answer