Get ALL Query Results via REST API call without pagination

I have a datasource that has more than 2 Million Rows. I’d like to retrieve all rows via the REST API in JSON format without having to paginate and issue multiple requests. Do you have any code examples that show how this can be done?

The only REST Api we support requires pagination. For such large results we usually recommend jdbc/odbc.