Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

How to use Pagination in Custom Page API in Business central

(1) ShareShare
ReportReport
Posted on by 144
Hi All,

I am using On-Prem Business Central.

I have created one Custom Page API to fetch Items from Business Central, but its taking to much long time to get all the 20,000 item.
I want to use pagination in this API to fetch 15 record for each API call, but i never use or heard about pagination in Page API.

Does anyone have any idea about it. How we can implement it or if you have any code snip you can share.

Page API code :   This is my API where i want to use Pagination.
 
page 50119 "GetAllItemsDetail"
{
    PageType = API;
    APIVersion = 'v1.0';
    APIPublisher = 'QueryV1';
    APIGroup = 'QueryGroup';
    EntityName = 'Item';
    EntitySetName = 'Items';
    DelayedInsert = true;
    SourceTable = Item;
    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field(Id; Rec.SystemId)
                {
                    Caption = 'Id';
                }
                field(ItemNo; Rec."No.")
                {
                    Caption = 'Item No';
                }
                field(Name; Rec.Description)
                {
                    Caption = 'Description';
                }
                field(Base_Unit_Price; Rec."Unit Price")
                {
                    Caption = 'Base Unit Price';
                }
            }
        }
    }
}
 
Thanks for your Help.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 4,744 on at
    How to use Pagination in Custom Page API in Business central
    Hi,  you can use the built-in pagination support for Page APIs with the $top and $skip query parameters automatically handled by the API framework. you can make API calls using the standard pagination parameters:
    To retrieve the first 15 items:
  • gdrenteria Profile Picture
    gdrenteria 12,290 Most Valuable Professional on at

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans