[API Request] Add pagination (size, offset) parameters to additional API methods #104
Replies: 2 comments 12 replies
-
As discussed before we first need to think about a proper pagination API and new proper endpoints to support that and proper filtering and sorts. The main issue with raw size and offset values is that they are very hard to handle server side for sorts like random. You need a seed value and somehow keep it for the next queries, but how long and all the side effects if wrongly handled. |
Beta Was this translation helpful? Give feedback.
-
But then again, the original Subsonic API already contains pagination on the endpoints Of course it's a possible solution to completely redesign the thing but this would be a lot more work than just adding some parameters. And if the amount of work needed means, that it will actually never happen, then the "best" may be the enemy of "good enough". |
Beta Was this translation helpful? Give feedback.
-
Type of change
API tweak
Proposal description
I propose that
size
andoffset
request parameters be added to more API methods which are capable of returning arbitrarily-sized collections.Music libraries may be very large. Some methods currently have no paging support and may return thousands of large records, causing a performance impact and memory demand on servers and clients.
If
size
andoffset
are available, the returned data structures may be smaller, more manageable and delivered at lower latency.Backward compatibility impact
No impact - the new parameters would be optional.
Backward compatibility
API details
Each method gets two new optional parameters:
size
- The number of elements to return. Defaults to no limit (for backwards compatibility).offset
- The zero-based offset to start from in the list. Defaults to zero.My suggestion is that these parameters should be added to (in alphabetical order):
getArtists
getBookmarks
getCaptions
getChatMessages
getInternetRadioStations
getGenres
getPlaylists
getPodcasts
getShares
getUsers
getVideos
Optional
There are some methods which perform the same feature but with the
size
parameter namedcount
, for examplegetTopSongs
. For these, we could addsize
as a synonym forcount
and look to removecount
long term, deprecating it for now.Security impacts
No response
Potential issues
No response
Alternative solutions
No response
Beta Was this translation helpful? Give feedback.
All reactions