How to create aggregator Paginated API on top of non paginated apis?

Issue

Here is the problem

(Microservice A) API A: returns large data set of ItemA (Non Paginated)
(Microservice B) API B: returns small data set of ItemB (Non Paginated)

(Microservice C) API C: calls API A and API B and aggregates data

I’d like API C to be paginated but not sure this is possible on top of 2 NON paginated apis without doing complex logic within API C itself

Is it a bad practice? Or should the API A and API B be converted to paginated?

Solution

You can write complex logic in API C to support pagination but if the APIs(A & B) supports filters, you would have a hard time.
You should ideally work towards making API A & B support paginated responses.

Answered By – Ajit Kumar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published