INTRODUCTION
In IBM Sterling OMS, various list APIs can return large volumes of data simultaneously, with a default limit of 5,000 records. The getPage API is designed to manage this substantial response by allowing results to be viewed across multiple pages. By using page numbers, it helps retrieve specific pages and prevents overwhelming users with excessive information at once. The getPage API is always integrated with other list APIs, offering different strategies for paginating the results.
GETPAGE API STRATEGIES
- GENERIC
- ROWNUM
- RESULTSET
- NEXTPAGE
1. GENERIC STRATEGY
The generic strategy enables the results are fetched in one go and stored in cache. This means that subsequent requests can retrieve data quickly without needing to re-query the underlying API.
It provides a PageSetToken value, which allows for retrieving the sequence of remaining pages in the output XML. This strategy is specifically designed to support all list APIs.
WORKING SAMPLE :
<Page PageSize=”40″ PaginationStrategy=”GENERIC”> <API IsFlow=”N” Name=”getOrderList” Version=””> <Input> <Order DocumentType=”0001″> <OrderBy> <Attribute Name=”OrderHeaderKey” Desc=”Y”/> </OrderBy> <ComplexQuery Operator=”AND”> <And> <Exp Name=”Extn_ExtnSourceCustomerID” Value=”C102″ QryType=”EQ”/> <Exp Name=”OrderDate” FromOrderDate=”20230101″ ToOrderDate=”20240919″ OrderDateQryType=”DATERANGE”/> </And> </ComplexQuery> </Order> </Input> <Template> <OrderList> <Order OrderNo=“” OrderHeaderKey=“” OrderDate=“”/> </OrderList> </Template> </API> </Page> |
Output:
PageSetToken : The PageSetToken is a unique identifier used to retrieve a page from the cache at a later time. If the application server is restarted, the PageSetToken cache will be cleared. The GENERIC strategy only returns this token.
PageSetToken=”DESKTOP-5M21SHG:node1:-472c783e:192143ddf3b:-7987″
Get Second Page
To retrieve the second page of the getOrderList API output, pass the PageSetToken obtained from the initial execution of the getPage API, along with the PageNumber and Page Size.
<Page PageNumber=“2” PageSetToken=“DESKTOP-5M21SHG:node1:-472c783e:192143ddf3b:-7987” PageSize=“40”>
Output
This will return the next 40 records from the getOrderList API output.
Get Invalid Page
If the provided page number is not present in the response, it will return IsValidPage=”N,” indicating that the page is not valid.
<Page PageNumber=“4” PageSetToken=“DESKTOP-5M21SHG:node1:-472c783e:192143ddf3b:-7987” PageSize=“40”>
Output
2. ROWNUM Strategy
The ROWNUM strategy is designed to facilitate the retrieval of records starting from a specified point in the dataset. This is particularly useful when dealing with large volumes of data, as it enables users to navigate through records without having to load all data at once.
WORKING SAMPLE:
Fetch the shipment details which meet the following criteria
- Find the shipments which belongs to ‘SRK_Retail’ enterprise
- Document type is ‘0001’.
To obtain the desired page of data, specify the Pagination Strategy as ‘ROWNUM,’ set the PageSize to ’20,’ and provide the page number. The input XML will be used to fetch Page Number one with a Page Size of 20.
<Page PageNumber=”1″ PageSize=”20″ PaginationStrategy=”ROWNUM”> <ReferenceData/> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getShipmentLineList”> <Input> <ShipmentLine DocumentType=”0001″ EnterpriseCode=”SRK_Retail”/> </Input> <Template> <ShipmentLines> <ShipmentLine ItemDesc=“” ItemID=“” Quantity=“” ReleaseNo=“” ShipmentKey=“” ShipmentLineKey=“” ShipmentLineNo=“”> <Shipment Status=“”/> <OrderLine Status=“” StatusQuantity=“”/> </ShipmentLine> </ShipmentLines> </Template> </API> </Page> |
Output: First 20 set of data
Input XML to get the second Page Number with Page size 20
<Page PageNumber=”2″ PageSize=”20″ PaginationStrategy=”ROWNUM”> <ReferenceData/> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getShipmentLineList”> <Input> <ShipmentLine DocumentType=”0001″ EnterpriseCode=”SRK_Retail”/> </Input> <Template> <ShipmentLines> <ShipmentLine ItemDesc=“” ItemID=“” Quantity=“” ReleaseNo=“” ShipmentKey=“” ShipmentLineKey=“” ShipmentLineNo=“”> <Shipment Status=“”/> <OrderLine Status=“” StatusQuantity=“”/> </ShipmentLine> </ShipmentLines> </Template> </API> </Page> |
Output :
Input XML to get the Page Number 11 with Page size 20
<Page PageNumber=“11” PageSize=“20” PaginationStrategy=“ROWNUM”> <ReferenceData/> <PreviousPage PageNumber=“”/> <API IsFlow=“N” Name=“getShipmentLineList”> <Input> <ShipmentLine DocumentType=“0001” EnterpriseCode=“SRK_Retail”/> </Input> <Template> <ShipmentLines> <ShipmentLine ItemDesc=“” ItemID=“” Quantity=“” ReleaseNo=“” ShipmentKey=“” ShipmentLineKey=“” ShipmentLineNo=“”> <Shipment Status=“”/> <OrderLine Status=“” StatusQuantity=“”/> </ShipmentLine> </ShipmentLines> </Template> </API> </Page> |
Output return the IsLastPage=”Y means this is the last page of the output
3. RESULTSET STRATEGY
The RESULTSET strategy is a specific approach within the getPage API that focuses on managing how data is retrieved and presented from database, particularly when dealing with extensive records. This strategy allows for efficient data handling without overloading the system and returns the specified page of data.
WORKING SAMPLE :
The getItemList API will retrieve the item details for the enterprise ‘Matrix.’ To obtain the desired page of data, specify the Pagination Strategy as ‘RESULTSET,’ set the PageSize to ’30,’ and provide the page number. The input XML will be used to fetch Page Number one with a Page Size of 30.
<Page PageNumber=”1″ PageSize=”30″ PaginationStrategy=”RESULTSET”> <ReferenceData/> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getItemList”> <Input> <Item OrganizationCode=”Matrix”/> </Input> <Template> <ItemList> <Item CanUseAsServiceTool=“” GlobalItemID=“” ItemGroupCode=“” ItemID=“” ItemKey=“” OrganizationCode=“” UnitOfMeasure=“”/> </ItemList> </Template> </API> </Page> |
Input XML to get the fourth Page Number with Page size 30
<Page PageNumber=”4″ PageSize=”30″ PaginationStrategy=”RESULTSET”> <ReferenceData/> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getItemList”> <Input> <Item OrganizationCode=”Matrix”/> </Input> <Template> <ItemList> <Item CanUseAsServiceTool=“” GlobalItemID=“” ItemGroupCode=“” ItemID=“” ItemKey=“” OrganizationCode=“” UnitOfMeasure=“”/> </ItemList> </Template> </API> </Page> |
Output
Even though page size is 30, due to less number of items available in OMS, it will bring 15 records only in last page of it.
4. NEXTPAGE STRATEGY
The NEXTPAGE strategy operates by using data from the previous request. To access the next page of data, you need to include the last record from the previous getPage API result in the PreviousPage tag of your input. This approach ensures a seamless transition between pages and facilitates ongoing data retrieval.
Input
The getOrderList API is used to retrieve a list of order details with a document type of “0001” for the enterprise “Matrix.” To structure the input, set the Pagination Strategy to ‘NEXTPAGE’ and specify the Page Size as 20 for the Matrix enterprise. This configuration allows for efficient retrieval of order data, facilitating seamless navigation through the results.
<Page PageSize=”20″ PaginationStrategy=”NEXTPAGE”> <ReferencedData/> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getOrderList” Version=””> <Input> <Order DocumentType=”0001″ EnterpriseCode=”Matrix”/> </Input> <Template> <OrderList> <Order OrderNo=“” OrderHeaderKey=“” OrderDate=“”/> </OrderList> </Template> </API> </Page> |
Output
Last Record of the current page . It should be used to get next page of data.
<Order OrderDate=“2023-03-23T18:56:42-04:00” OrderHeaderKey=“2023032318564229363” OrderNo=“Matrix_PS_DS_02”/> |
Input XML to get the next page of data
Pass the page number and order details of the previous page for Matrix enterprise and it will bring the next page of data.
<Page PageSize=”20″ PaginationStrategy=”NEXTPAGE”> <ReferencedData/> <PreviousPage PageNumber=”1″> <Order OrderDate=”2023-03-23T18:56:42-04:00″ OrderHeaderKey=”2023032318564229363″ OrderNo=”Matrix_PS_DS_02″/> </PreviousPage> <API IsFlow=”N” Name=”getOrderList” Version=””> <Input> <Order DocumentType=”0001″ EnterpriseCode=”Matrix”/> </Input> <Template> <OrderList> <Order OrderNo=“” OrderHeaderKey=“” OrderDate=“”/> </OrderList> </Template> </API> </Page> |
Output
Input XML to get the next page of data
<Page PageSize=”20″ PaginationStrategy=”NEXTPAGE”> <ReferencedData/> <PreviousPage PageNumber=”2″> <Order OrderDate=”2023-03-24T14:48:44-04:00″ OrderHeaderKey=”2023032414484435865″ OrderNo=”Matrix_PS_DS_06″/> </PreviousPage> <API IsFlow=”N” Name=”getOrderList” Version=””> <Input> <Order DocumentType=”0001″ EnterpriseCode=”Matrix”/> </Input> <Template> <OrderList> <Order OrderNo=“” OrderHeaderKey=“” OrderDate=“”/> </OrderList> </Template> </API> </Page> |
Output
Repeat it until to get the last page of the result set.
Get Required Page based for particular order
The Reference Data tag is utilized to retrieve a page based on the specified data. For instance, rather than navigating through each page individually to obtain order details, we can directly access the page containing the desired order by including the specific order details within the ReferenceData tag in the input XML.
<ReferenceData> <Order OrderDate=“2023-04-13T14:29:31-04:00” OrderHeaderKey=“2023041314293262242” OrderNo=“Matrix37”/> </ReferenceData> |
Input
To get the particular page in which page has this OrderHeaderKey=“2023041314293262242”
<Page PageSize=”10″ PaginationStrategy=”GENERIC”> <ReferenceData> <Order OrderDate=”2023-04-13T14:29:31-04:00″ OrderHeaderKey=”2023041314293262242″ OrderNo=”Matrix37″/> </ReferenceData> <PreviousPage PageNumber=””/> <API IsFlow=”N” Name=”getOrderList” Version=””> <Input> <Order DocumentType=”0001″ EnterpriseCode=”Matrix”/> </Input> <Template> <OrderList> <Order OrderNo=“” OrderHeaderKey=“” OrderDate=“”/> </OrderList> </Template> </API> </Page> |
Output
It returns Page number 10. Page 10 has this Order information.
#LetsTalkOMS #SpicaTech