Forum

Power query paginat...
 
Notifications
Clear all

Power query pagination

2 Posts
2 Users
0 Reactions
133 Views
(@chrisds)
Posts: 1
New Member
Topic starter
 

 I have a REST API connection to a CRM where I need to pickup sales data. However when I make the connection I only get 100 lines of sales result.

Can anyone point me in the right direction to apply pagination to this REST API connection?

 

let
Source = Json.Document(Web.Contents("https://**.myarchie.eu/api/organization/656823562034BOCP9548ABA8269/sales-history", [Headers=[#"X-Archie-Username"="", #"X-Archie-Password"="********"]])),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "saleId", "articleNumber", "price", "quantity", "date", "initials", "discountAmount", "description", "orderNumber", "articleGroup", "cost", "campaignCode", "saleType", "articleCategory", "invoiceNumber", "vatCode", "vatAmount", "discountPercentage", "numberPerPrice", "serials", "statistics", "weight", "organization"}, {"Column1.id", "Column1.saleId", "Column1.articleNumber", "Column1.price", "Column1.quantity", "Column1.date", "Column1.initials", "Column1.discountAmount", "Column1.description", "Column1.orderNumber", "Column1.articleGroup", "Column1.cost", "Column1.campaignCode", "Column1.saleType", "Column1.articleCategory", "Column1.invoiceNumber", "Column1.vatCode", "Column1.vatAmount", "Column1.discountPercentage", "Column1.numberPerPrice", "Column1.serials", "Column1.statistics", "Column1.weight", "Column1.organization"}),
#"Expanded Column1.serials" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.serials", {"contentType", "value"}, {"Column1.serials.contentType", "Column1.serials.value"}),
#"Expanded Column1.organization" = Table.ExpandRecordColumn(#"Expanded Column1.serials", "Column1.organization", {"id", "code", "displayName", "color", "name", "homeAddress", "tel", "email", "deleted", "readOnly", "protectMode"}, {"Column1.organization.id", "Column1.organization.code", "Column1.organization.displayName", "Column1.organization.color", "Column1.organization.name", "Column1.organization.homeAddress", "Column1.organization.tel", "Column1.organization.email", "Column1.organization.deleted", "Column1.organization.readOnly", "Column1.organization.protectMode"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1.organization",{{"Column1.date", type datetime}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Column1.date", type date}})
in
#"Changed Type1"

 
Posted : 31/01/2024 2:18 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Chris,
Have to see the response of one request, not all API are built with the same structure.

Some provide a total count and items per page limit, you have to calculate and increment the page in a loop.

On other api's, you get a NextLink in response.

All depends on their documentation.

 
Posted : 01/02/2024 2:23 pm
Share: