POST /rest/servicedeskapi/request/{issueIdOrKey}/comment
This method creates a public or private (internal) comment on a customer request, with the comment visibility set by public. The user recorded as the author of the comment.
package main
import (
"context"
"github.com/ctreminiom/go-atlassian/jira/sm"
"log"
"os"
)
func main() {
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
atlassian, err := sm.New(nil, host)
if err != nil {
return
}
atlassian.Auth.SetBasicAuth(mail, token)
atlassian.Auth.SetUserAgent("curl/7.54.0")
var (
issueKeyOrID = "DESK-12"
body = "Hello there"
)
newComment, response, err := atlassian.Request.Comment.Create(context.Background(), issueKeyOrID, body, true)
if err != nil {
log.Fatal(err)
}
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
log.Println("----------------------------------")
log.Printf("Comment, ID: %v", newComment.ID)
log.Printf("Comment, Creator Name: %v", newComment.Author.DisplayName)
log.Printf("Comment, Created Date: %v", newComment.Created.Friendly)
log.Printf("Comment, # of attachments: %v", newComment.Attachments.Size)
log.Printf("Comment, is public?: %v", newComment.Public)
log.Println("----------------------------------")
}
Get request comment by id
GET /rest/servicedeskapi/request/{issueIdOrKey}/comment/{commentId}
This method returns details of a customer request's comment.
GET /rest/servicedeskapi/request/{issueIdOrKey}/comment
This method returns all comments on a customer request. No permissions error is provided if, for example, the user doesn't have access to the service desk or request, the method simply returns an empty response.