web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

OData V4 Web Service Max Page Size

(0) ShareShare
ReportReport
Posted on by 25

Hi,

My client is running BC 365 on an Azure server of which I do not have configuration access.  Using OData v4 I am trying to set a MaxPageSize using Prefer header -- see PS1 snippet below:

 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Accept','Application/Json')
$headers.Add('Api-Key' , [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($actualKey)))
$headers.Add('OData-MaxVersion','4.0')
$headers.Add('OData-Version','4.0')
$headers.Add('Prefer', 'odata.include-annotations=*, maxpagesize=5, odata.maxpagesize=5')
$headers.Add('Content-Type' , 'application/json')
 
(The maxpagesize/odata.maxpagesize part is taken from the OData specification).

The Max Page Size directives are being ignored and there is no Preference Applied header in the response.

Does BC 365 OData V4 support the Prefer header? If so, which server setting change has to be made?

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    If you ‘re working onpremise, you can change the ODATA max page size by going to the service tier configuration and change the “Max Page Size” value. This is the only supported setting.

    For SaaS you cannot do this.

  • Graziano Tartari Profile Picture
    222 on at

    Stefano,
    reading the bottom of this paragraph learn.microsoft.com/.../server-driven-paging-in-odata-web-services it seems be possible.

    But in our env it continues to be ignored. Do you have an evidence to prove that you suggested the only valid setting to limit the size?

    [Edit 1] Maybe a version problem? We use a BC16 but this guide refers to 2022 version.
    [Edit 2] Having a deep look inside the learn guide I discovered that the client side parameter odata.maxpagesize was introduced on 28 May 2021, near the release of 2021 RW1. 

    Now we are trying to test in it. I'll update the post soon.  

    Regards,
    Graziano.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    The above response was given more than 2 years ago. Now also on-prem and SaaS apis supports odata.maxpagesize parameter in request header. Not sure if BC 16 supports it however (it's quite an old version and I think it was released later).

  • Graziano Tartari Profile Picture
    222 on at

    Stefano,
    I confirm. Since BC19 released on 2021 the prefer option max_page_size works. 

    Regards,
    Graziano.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans