-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cases] Create new endpoints to replace the deprecated ones. #134344
Comments
Pinging @elastic/response-ops-cases (Feature:Cases) |
@cnasikas for the find APIs do we want to allow pagination using Or maybe the user actions find API uses search after but the comment API sticks with the traditional saved object core's find function? |
@jonathan-buttner I think it is fine to use |
Do you think it makes sense to have the |
Good catch. Make sense to me. |
This PR adds a new find API for retrieving a subset of the user actions for a case. Issue: #134344 ``` GET /api/cases/<case_id>/user_actions/_find Query Paramaters { types?: Array of "assignees" | "comment" | "connector" | "description" | "pushed" | "tags" | "title" | "status" | "settings" | "severity" | "create_case" | "delete_case" | "action" | "alert" | "user" | "attachment" sortOrder?: "asc" | "desc" page?: number as a string perPage?: number as a string } ``` <details><summary>Example request and response</summary> Request ``` curl --location --request GET 'http://localhost:5601/api/cases/8df5fe00-96b1-11ed-9341-471c9630b5ec/user_actions/_find?types=create_case&sortOrder=asc' \ --header 'kbn-xsrf: hello' \ --header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \ --data-raw '' ``` Response ``` { "userActions": [ { "created_at": "2023-01-17T21:54:45.527Z", "created_by": { "username": "elastic", "full_name": null, "email": null, "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" }, "owner": "cases", "action": "create", "payload": { "title": "Awesome case", "tags": [], "severity": "low", "description": "super", "assignees": [], "connector": { "name": "none", "type": ".none", "fields": null, "id": "none" }, "settings": { "syncAlerts": false }, "owner": "cases", "status": "open" }, "type": "create_case", "id": "8e121180-96b1-11ed-9341-471c9630b5ec", "case_id": "8df5fe00-96b1-11ed-9341-471c9630b5ec", "comment_id": null } ], "page": 1, "perPage": 20, "total": 1 } ``` </details> ## Notable Changes - Created the new `_find` route - Created a new `UserActionFinder` class and moved the find* methods from the `index.ts` file into there as well as the new find logic - Extracted the transform logic to its own file since its shared between multiple files now - Extracted the user action related integration test functions to the `user_action.ts` utility file Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: lcawl <lcawley@elastic.co>
@cnasikas with regards to the |
@jonathan-buttner Yes, we can reshape the endpoint to our needs. It is not considered a breaking change. As you said, we never documented and it is not used by anyone. Btw, should we rename |
Sounds good to me, do we want it as an internal API for now? |
I think is better to make it public as we want to offer an alternative to the deprecated endpoint ( |
Hey @cnasikas ! Is the intention to remove these deprecated APIs by 9.0? |
Yes, this is correct! |
Closing in favor of #194266. |
On 8.1 we deprecated the following endpoints:
includeComments
query parameter.We should create new endpoints in place of the deprecated ones:
GET /api/cases/<case_id>/user_actions/_find
GET /api/cases/<case_id>/attachments/_find
status
metric.The
GET /api/cases/<case_id>/attachments/_find
should support the following query options:page
: The page of objects to returnperPage
: The number of objects to return per pagetypes
: The types of the commentsortOrder
: The sorting order. Valid optionsasc
ordesc
The
GET /api/cases/<case_id>/user_actions/_find
should support the following query options: (#148861)page
: The page of objects to returnperPage
: The number of objects to return per pagetypes
: The types of the user actions. This is an array. Valid options: all user action types plusaction
(subject to change),alert
,user
, andattachment
. Theaction
is used to group all user actions that are not of typecomment
.action
: The action of the user actionsortOrder
: The sorting order. Valid optionsasc
ordesc
The owner will be deducted from the case
The text was updated successfully, but these errors were encountered: