Skip to content

Commit

Permalink
[DOCS] Add get case comments API (#128694)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Mar 29, 2022
1 parent 7039878 commit c3fba60
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/api/cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ these APIs:
* {security-guide}/cases-api-find-cases-by-alert.html[Find cases by alert]
* <<cases-api-find-connectors>>
* {security-guide}/cases-api-get-case-activity.html[Get all case activity]
* {security-guide}/cases-api-get-all-case-comments.html[Get all case comments]
* <<cases-api-get-case>>
* {security-guide}/cases-api-get-comment.html[Get comment]
* <<cases-api-get-comments>>
* {security-guide}/cases-get-connector.html[Get current connector]
* {security-guide}/cases-api-get-reporters.html[Get reporters]
* {security-guide}/cases-api-get-status.html[Get status]
Expand All @@ -36,5 +35,6 @@ include::cases/cases-api-find-cases.asciidoc[leveloffset=+1]
include::cases/cases-api-find-connectors.asciidoc[leveloffset=+1]
//GET
include::cases/cases-api-get-case.asciidoc[leveloffset=+1]
include::cases/cases-api-get-comments.asciidoc[leveloffset=+1]
//UPDATE
include::cases/cases-api-update.asciidoc[leveloffset=+1]
6 changes: 3 additions & 3 deletions docs/api/cases/cases-api-delete-comments.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ You must have `all` privileges for the *Cases* feature in the *Management*,
<<cases-api-find-cases>>.

`<comment_id>`::
(Optional, string) The identifier for the comment.
//To retrieve comment IDs, use <<cases-api-get-all-case-comments>>.
If it is not specified, all comments are deleted.
(Optional, string) The identifier for the comment. To retrieve comment IDs, use
<<cases-api-get-case>> or <<cases-api-find-cases>>. If it is not specified, all
comments are deleted.

<space_id>::
(Optional, string) An identifier for the space. If it is not specified, the
Expand Down
80 changes: 80 additions & 0 deletions docs/api/cases/cases-api-get-comments.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[[cases-api-get-comments]]
== Get comments API
++++
<titleabbrev>Get comments</titleabbrev>
++++

Gets a comment or all comments for a case.

=== Request

`GET <kibana host>:<port>/api/cases/<case ID>/comments/<comment ID>`

`GET <kibana host>:<port>/s/<space_id>/api/cases/<case ID>/comments/<comment ID>`

`GET <kibana host>:<port>/api/cases/<case_id>/comments` deprecated:[8.1.0]

`GET <kibana host>:<port>/s/<space_id>/api/cases/<case_id>/comments` deprecated:[8.1.0]

=== Prerequisite

You must have `read` privileges for the *Cases* feature in the *Management*,
*{observability}*, or *Security* section of the
<<kibana-feature-privileges,{kib} feature privileges>>, depending on the
`owner` of the cases with the comments you're seeking.

=== Path parameters

`<case_id>`::
(Required, string) The identifier for the case. To retrieve case IDs, use
<<cases-api-find-cases>>.

`<comment_id>`::
(Optional, string) The identifier for the comment. To retrieve comment IDs, use
<<cases-api-get-case>>.
+
If it is not specified, all comments are retrieved.
deprecated:[8.1.0,The comment identifier will no longer be optional.]

`<space_id>`::
(Optional, string) An identifier for the space. If it is not specified, the
default space is used.

=== Response code

`200`::
Indicates a successful call.

=== Example

Retrieves comment ID `71ec1870-725b-11ea-a0b2-c51ea50a58e2` from case ID
`a18b38a0-71b0-11ea-a0b2-c51ea50a58e2`:

[source,sh]
--------------------------------------------------
GET api/cases/a18b38a0-71b0-11ea-a0b2-c51ea50a58e2/comments/71ec1870-725b-11ea-a0b2-c51ea50a58e2
--------------------------------------------------
// KIBANA

The API returns the requested comment JSON object. For example:

[source,json]
--------------------------------------------------
{
"id":"8acb3a80-ab0a-11ec-985f-97e55adae8b9",
"version":"Wzc5NzYsM10=",
"comment":"Start operation bubblegum immediately! And chew fast!",
"type":"user",
"owner":"cases",
"created_at":"2022-03-24T00:37:10.832Z",
"created_by": {
"email": "[email protected]",
"full_name": "Classified",
"username": "M"
},
"pushed_at": null,
"pushed_by": null,
"updated_at": null,
"updated_by": null
}
--------------------------------------------------
3 changes: 1 addition & 2 deletions docs/api/cases/cases-api-update.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ and `open`.
(Optional, string) A title for the case.
`version`::
(Required, string) The current version of the case.
//To determine this value, use <<cases-api-get-case>> or <<cases-api-find-cases>>
(Required, string) The current version of the case. To determine this value, use <<cases-api-get-case>> or <<cases-api-find-cases>>.
====

=== Response code
Expand Down

0 comments on commit c3fba60

Please sign in to comment.