Is it possible to do Pagination (of a JSON response) on Apigee Edge
For Example –
A backend – (that does not have any paging mechanism) - returns a JSON array of 200 items.
Can we store the response in a Cache - and then Query on the Cache – to return 10 items at a time.
(I have seen something similar done using XSL Transformation - in one of the cookbook examples, but it doesn't suggest anything for paging JSON responses.)
Solved! Go to Solution.
So the way - I figured - I would do it is as follows : 1. Use LookUpCache
2. If LookUpCache fails - do a Service Callout (sync) -wait of it.
3. Populate Cache
4. LookUpCache again (store response in a variable)
5. Use a JavaScript policy - JSON parse the variable from LookUpCache
6. Use JSON Splice - (based on limit and offset - in queryparam)
7. Set response as the Spliced JSON.
This worked for my sample data; Please provide comments if this way can be used for pagination of a JSON response on Apigee Edge. Please let me know - any drawbacks to this approach, any modifications or better solutions.