Limiting rows

API Discussion
Is it possible to limit rows with the api by setting some parameter after the request ?


There isn't really a concept of rows in the APIs (at least in the endpoints I've used). What end-point are you talking about and what are you looking to limit exactly?
If I am getting the leaderboards data (PVP endpoint) it's quite huge.
I want to limit the number of rows returned because I only need like 15-20.

The API docs don't have a way of doing this so you'll need to process this on the server before passing the limited rows to the client.

Assuming PHP you could do this quite easily
/* $data being the json_decode()'d API response */
$top = array_slice($data['rows'], 0, 20);
Hmmmm is this also possible in Java ?
'fraid I don't know Java but a quick Google for an equivalent to PHP's array_slice came back with this:

Hope it helps!
I posted this today . Limiting is only possible when I get back the result I guess. But thanks for your time :) !
Ah right, this being an app changes the context of the answer a little but the answer to the issue is still correct. You can't limit an HTTP response so the app would handle slicing the part of the array you want to use.

Join the Conversation

Return to Forum