Prisma Cloud: 偏移分页不适用于列表警报
5562
Created On 01/14/22 01:54 AM - Last Modified 03/02/23 03:50 AM
Symptom
用户无法使用“列表警报”的“抵消”请求字段 -POST ”和“列表警报 V2 -POST " API
Environment
- Prisma Cloud
- 偏移分页
Cause
不推荐使用偏移分页警报 2.0 .
以下两者API呼叫将返回同一组警报
偏移量 0 请求:
curl --location --request POST 'https://api3.prismacloud.io/v2/alert' \
--header 'x-redlock-auth: JWT' \
--header 'x-b3-traceid: 2250874b71d74d959d412c461f411fff' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain, */*' \
--data-raw '{"detailed":false,"filters":[{"name":"alert.status","operator":"=","value":"open"},{"name":"policy.id","operator":"=","value":"ca5c571e-6930-44af-a47b-ebde3ac20ca5"}],"timeRange":{"type":"to_now","value":"epoch"},"limit":20,"offset": 0, "sortBy":["id"]}'
偏移量 10 请求:
curl --location --request POST 'https://api3.prismacloud.io/v2/alert' \
--header 'x-redlock-auth: JWT' \
--header 'x-b3-traceid: 2250874b71d74d959d412c461f411fff' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain, */*' \
--data-raw '{"detailed":false,"filters":[{"name":"alert.status","operator":"=","value":"open"},{"name":"policy.id","operator":"=","value":"ca5c571e-6930-44af-a47b-ebde3ac20ca5"}],"timeRange":{"type":"to_now","value":"epoch"},"limit":20,"offset": 10, "sortBy":["id"]}'Resolution
对于我们的应用程序,最佳做法是基于令牌进行分页,因为不支持偏移分页。 大多数云提供商的 API 还支持基于令牌的分页。
Additional Information
偏移分页仍然适用于 Alerts 1.0。