Add support for pagination to api