There is a howto topic on reverse engineering the API using the F12 key in your browser, I suggest referring to that. All data you see on screen in Discourse, is always retrieved via JSON.
In my particular case, I’d like to show “TOP X” users with various ordering dynamically on my blog pages. The blog is a website complementing the forum. For example:
In that case, the developer console network tab is the way to go. Click until it’s sorted the way you want it displayed, and look at the parameters for the last request.