Skip to content

[8.19] [Lens] Add internal CRUD api routes (#223296)#225463

Closed
nickofthyme wants to merge 3 commits intoelastic:8.19from
nickofthyme:backport/8.19/pr-223296
Closed

[8.19] [Lens] Add internal CRUD api routes (#223296)#225463
nickofthyme wants to merge 3 commits intoelastic:8.19from
nickofthyme:backport/8.19/pr-223296

Conversation

@nickofthyme
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

## Summary

This adds basic Lens CRUD api routes using the Content Management
system.

| Operation | URI |
|--------|--------|
| Create | `POST api/lens/visualizations` |
| Get | `GET api/lens/visualizations/{id}` |
| Search | `GET api/lens/visualizations?query=test` |
| Update | `PUT api/lens/visualizations/{id}` |
| Delete | `DELETE api/lens/visualizations/{id}` |

### Changes to Lens Content Management

The custom `update` method uses `soClient.create` under the hood for
reasons (i.e. elastic#160116). However, doing this acts as an update or create
method with the provided `id`. I changed this behavior so now any update
where the id is not found will return a `404` error.

Closes elastic#221941
Closes elastic#221942 - OpenAPI docs auto generate from route schema

### Testing

You can testing this locally in kibana dev console like so...

```
GET kbn:/api/lens/visualizations/<id>?apiVersion=1
```

> The `apiVersion` query param is needed to test `internal` api routes.

## Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
(cherry picked from commit 17c2556)

# Conflicts:
#	.github/CODEOWNERS
@nickofthyme nickofthyme added the backport This PR is a backport of another PR label Jun 26, 2025
@nickofthyme nickofthyme enabled auto-merge (squash) June 26, 2025 14:01
@nickofthyme nickofthyme requested a review from a team June 26, 2025 15:46
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jul 1, 2025

💔 Build Failed

Failed CI Steps

History

@nickofthyme nickofthyme closed this Jul 1, 2025
auto-merge was automatically disabled July 1, 2025 14:32

Pull request was closed

@nickofthyme nickofthyme deleted the backport/8.19/pr-223296 branch July 30, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants