elastic / elastic/docs-content

[Website]: GET /api/endpoint/metadata API docs have incorrect pagination information

Open
#5,887 2 comments 0 reactions 0 assignees View on GitHub
source:web Team:Experience
Dominant language
No language data
Stars
47
Forks
261
Avg merge
3d 12h
Merged PRs (30d)
116

Description

### Type of issue

Inaccurate

### What documentation page is affected

https://www.elastic.co/docs/api/doc/kibana/v9/operation/operation-getendpointmetadatalist

### What happened?

A public issue was filed for this here: https://github.com/elastic/kibana/issues/262619

This bug report mentions two issues, the first one with the UI I will deal with separately, for the pagination issue:

- When using the `/api/endpoint/metadata`, results in an empty list. So long as `pageSize` is less than total, they can get results, but anything greater than or equal empties out the data list:
```
{'data': [],
'total': 23,
'page': 1,
'pageSize': 30,
'sortField': 'enrolled_at',
'sortDirection': 'desc'}
```

- The following calls demonstrate how pagination returns results with `page=0` for the endpoint:
```
curl -sH "Authorization: ..." "https://:443/api/endpoint/metadata?pageSize=20&page=0" | jq '.data | length'
20
curl -sH "Authorization: ..." "https://:443/api/endpoint/metadata?pageSize=50&page=0" | jq '.data | length'
24
curl -sH "Authorization: ..." "https://:443/api/endpoint/metadata?pageSize=20&page=1" | jq '.data | length'
4
curl -sH "Authorization: ..." "https://:443/api/endpoint/metadata?pageSize=50&page=1" | jq '.data | length'
0
```

ISSUE --> The [API docs](https://www.elastic.co/docs/api/doc/kibana/v9/operation/operation-getendpointmetadatalist) state that pagination starts at `1` but it actually starts at `0`:
Image

All I could find around this bug is this open discussion on how to standardize pagination across Kibana: https://github.com/elastic/kibana/issues/135490, but nothing reported

### Additional info

I see two issues when comparing to the [endpoint code](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/common/api/endpoint/metadata/list_metadata.ts)

- Page number has a min 0 (docs say 1)
- PageSize has a min of 1 and max of 10000 (docs say max 100)

The default values are stored in the [constants file](https://github.com/elastic/kibana/blob/bb03d133dc236cd8ddbc3ab4d92e7af0a5efe89a/x-pack/solutions/security/plugins/security_solution/common/endpoint/constants.ts#L125-L126)
- Page number = 0 (docs are wrong)
- Page size = 10 (docs are correct)

Is it possible that the docs are picking up the wrong definition?
This one would match what the docs mention: https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/docs/openapi/ess/security_solution_endpoint_management_api_2023_10_31.bundled.schema.yaml#L2117-L2129

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.