Skip to content

Allow to comment issue#2

Open
Koisell wants to merge 1 commit intoallantl:masterfrom
Koisell:support-add-comment
Open

Allow to comment issue#2
Koisell wants to merge 1 commit intoallantl:masterfrom
Koisell:support-add-comment

Conversation

@Koisell
Copy link
Copy Markdown

@Koisell Koisell commented Jul 29, 2020

We can comment issue via the update API but using direct API is
easier. This commit allows direct support to add comment to an issue.

We can comment issue via the update API but using direct API is
easier. This commit allows direct support to add comment to an issue.
@r2sd
Copy link
Copy Markdown

r2sd commented Aug 6, 2021

Would really appreciate if you could explain how to use the update API to add a comment.

Thanks!

client.updateIssue(
    "ISSUE-1",
    IssuePayload.apply(
      IssueField.apply("update", Json.obj("comment"-> Json.arr(Json.obj("add" -> Json.obj("body" -> Json.fromString("API Test"))))))
    )
  )

returns

Left(com.allantl.jira4s.v2.domain.errors.GenericError: Field 'update' cannot be set. It is not on the appropriate screen, or unknown.)

The same api works on REST with the body:

{
  "update": {
    "comment": [
      {
        "add": {
          "body": "API test"
        }
      }
    ]
  }
}

@Koisell
Copy link
Copy Markdown
Author

Koisell commented Aug 6, 2021

Like the error message explain there is no 'update' field. Fields refer to comment summery. It's explained in Jira documentation. One simple option if you want to send JSON-like call is to not specify fields.

      IssuePayload(
        Nil,
        None,
        Some(
          Json.obj(
            "comment" -> Json.arr(
              Json.obj(
                "add" -> Json.obj(
                  "body" -> "task done!")
                )
              )
            )
          )
        )
      )

@Koisell
Copy link
Copy Markdown
Author

Koisell commented Aug 6, 2021

BTW next time you have such question on Github you should make an issue. PR comments should be reserved to talk about the PR. If you think it's relevant you can then link the issue with a PR.

@r2sd
Copy link
Copy Markdown

r2sd commented Aug 6, 2021

Thanks a lot @Koisell , that worked perfect. Also, thanks for the tip on issue/PR. Will use it next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants