Monday, July 13, 2020

#784 Using Pagination with the OIC Shopify adapter


Starting point is the OIC Shopify adapter doc here
Quotes from the doc in italics.

In this simple example I will paginate thru my product list -
I have ca. 600 products. The number of products returned per page by Shopify can range from 50 to 250. I will set this value in the Shopify invoke mapping.

The OIC integration will use the Shopify Adapter to retrieve all products.
The structure returned will have the following format.

the page_info value is a link to the next page of results.
So the processing logic is very simple - process all pages!

This I will do in a WHILE loop - condition is - while there are still more pages available.

Implementing Shopify Pagination in OIC

I will use a scheduled orchestration - first step in that orchestration is to
Assign the following variables -

v_link will hold the page_info value.
v_check is simply an indicator set initially to false.
I will set this to true, when all pages have been processed.

Now I add the WHILE loop - condition will be v_check != "true"

Now I will query Products -

I configure the Shopify connection as follows -

Map as follows -

Target limit - number of Products per page limit - can be up to 250.
I set mine to 50.

Target link - The page_info element is a unique ID required to 
search and access the next page in the results.

Now I add a SWITCH (If) after the RetrieveAllProducts invoke.
Here I check if there are more pages -

Then I add an ASSIGN in this IF path to update my variables -

I also add an ASSIGN to the OTHERWISE path -
Here I set v_check = true

The integration looks as follows -

I activate and test - I have ca. 600 products - ergo the 12 iterations 

No comments: