Prisma Cloud: Offset Pagination Not Working For Listing Alerts

Prisma Cloud: Offset Pagination Not Working For Listing Alerts

5550
Created On 01/14/22 01:54 AM - Last Modified 01/27/23 21:57 PM


Symptom


User is unable to  use the "offset" request field of the "List Alerts - POST" and "List Alerts V2 - POST" APIs

 


Environment


  • Prisma Cloud
  • Offset Pagination


Cause


The use of offset pagination was deprecated with Alerts 2.0.

Both the following API calls will return the same set of alerts

Offset-0 request:

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"]}' 
Offset-10 request:
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


For our application, best practice is doing pagination based on token since offset pagination isn't supported. Most cloud provider's APIs also support token based pagination.

Additional Information


Offset pagination still works with Alerts 1.0.

Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u0000004Mq8CAE&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language