cancel
Showing results for 
Search instead for 
Did you mean: 

changing odata.maxpagesize in B1 service layer AJAX call

former_member260921
Participant
0 Kudos

Using Postman to set odata.maxpagesize the following works if I manually add the "Prefer" header before making the call.

GET /Invoices
Prefer:odata.maxpagesize=8

The preference shows as applied in the response header and the data includes the nextlink.

"odata.nextLink": "/b1s/v1/Invoices?$skip=8"

But I cannot get it to work in javascript/ajax

$.ajax({
type: "GET",
url: surl,
data: qParams.data,
datatype: "json",
contentType: "application/json",

Prefer: "odata.maxpagesize=8"

What is the correct syntax for adding the "Prefer" header in ajax? I have tried many possibilities so if anyone has a working example of how to code this it would be a big help.

Thanks,

Mel

View Entire Topic
Eneveux
Product and Topic Expert
Product and Topic Expert
0 Kudos

Mel,

Please see the SAP Business One ... Working with the SAP Business One Service Layer.

Section 3.7.6Paginate the Selected Orders

Hope that helps,

Eddy