board logo
Posted by: WUICTeam - Sunday, November 22, 2026 9:01:30 AM
[b]Question[/b] I read a table of 5,000 rows from [c]/odata/Cities[/c] and I only get 1000 rows back. If I ask for [c]$top=5000[/c] I get a 400. How do I read everything? [b]Answer[/b] Every response carries at most [c]odataMaxTop[/c] rows (default 1000), even when you send no [c]$top[/c]; a larger [c]$top[/c] is rejected with 400. You read the rest by paging, not by raising the limit in the request. The two ways: [list=1] [*][b]Ask for [c]$count=true[/c] and follow the link.[/b] The response becomes [c]{ "value": [...], "@odata.count": N }[/c]. When the page was cut by the limit (you sent no [c]$top[/c]) the wrapper also carries [c]@odata.nextLink[/c]: the same request with the [c]$skip[/c] of the next page. Follow it until it disappears. [*][b]Page by hand with [c]$top[/c] and [c]$skip[/c].[/b] Use [c]$top[/c] up to the limit and increase [c]$skip[/c] by that amount each time. With an explicit [c]$top[/c] there is no [c]nextLink[/c]; you stop when you get fewer rows than you asked for, or when you reach [c]@odata.count[/c]. [/list] The trap is the plain array: without [c]$count=true[/c] the endpoint answers a bare JSON array with no link, so an export that stops at exactly the row limit is truncated, not complete. Always add [c]$count=true[/c] in scripts, so you can compare what you read with the total. Paging is stable: the server appends the primary key to your [c]$orderby[/c] (or orders by the key alone), so rows are not lost or repeated between pages. The total in [c]@odata.count[/c] is computed after [c]$filter[/c] and before [c]$skip[/c]/[c]$top[/c]. [code] curl -H "Authorization: Bearer wuic_pat_..." \ "https://<host>/odata/Cities?\$count=true&\$orderby=cityName" # -> { "@odata.count": 5000, "value": [ ...1000 rows... ], # "@odata.nextLink": "https://<host>/odata/Cities?...&$skip=1000" } [/code] If you really need larger pages, raise [c]odataMaxTop[/c] in the application settings, keeping in mind that each response is materialized in memory. [url=https://wuic-framework.com/docs/odata]Documentation: OData[/url]