ramapi icon indicating copy to clipboard operation
ramapi copied to clipboard

How to get all characters, more than 20

Open thewh1teagle opened this issue 3 years ago • 2 comments

The method get_all_characters return only 20 results, in the next pages we have more results but the docs doesn't mention it and the library doesn't provide a way to get the next results

thewh1teagle avatar Mar 25 '22 05:03 thewh1teagle

@thewh1teagle I just stumbled upon this while learning how to work with and handle API requests/responses, and figured you may want an answer if you haven't received one. By calling the initial endpoint, you should be receiving a response of the first page of results. For additional pages, you would need to make a separate call but add:?pages=2 to the endpoint in order to reach page 2 and return those results, and so on for the remaining pages. I found that a "for loop" that increments the page numbers based on the initial JSON response for the "pages" key/pair is a pretty easy way to make all of the calls. I'd suggest writing the responses to an output file to continue working with the data so excessive calls aren't made.

LegitWIZRD avatar Dec 20 '22 01:12 LegitWIZRD

Thank you very much!

thewh1teagle avatar Dec 20 '22 12:12 thewh1teagle