GetProductPage usage

General Info

Word: POST
URL: {host_url}/api//inventory/product/GetProductPage

Method allows to fetch products in paging way. It may be configured in various ways in order to fetch specific subset of products information by specific filters.

Method returns page of objects of type ProducPageEntry that contains following properties:

  • Product - product itself. Its content is defined by property [PropertiesToLoad] of request;

  • OrganizationalUnitProperties - contains collection of organizational unit-specific product data. Their content is defined by property [OrganizationalUnitPropertiesRequest] of request;

  • ProductLocationData - contains collection of product location - specific product data. Their content is defined by property [LocationPropertiesRequest] of request;

  • Other ProductPageEntry properties : PurchaseQuantitySettings, SalesPrices, StockInfo, VariantsCurrentSalesPrices, VariantsOverridableProperties, CurrentSalesPrice, CurrentSalesPriceWithoutVat, ModificationInfo, OverridableProperties Their presence in ProducPageEntry is defined in property [PageEntryPropertiesToLoad] of request.

Configure scope of data to load

Properties of product

Set of properties of product to be loaded may be specified in [propertiesToLoad] property of request. This is a flag enum of type ProductProperties with following values:

Barcodes = 1, AttributeValues = 2, ComposedProductItems = 4, SearchTags = 8, Template = 16, VariantTemplate = 32, Category = 64, ProductInfoForBarcode = 64, ProductImages = 128, Manufacturer = 256, Suppliers = 512, Location = 1024, InstanceTemplate = 2048, Variants = 4096, RelatedProducts = 8192, VariantAttributeValues = 16384, PurchaseQuantitySettings = 32768, LocalizationResources = 65536, SeoProperties = 131072, WebProperties = 262144

Flags may be combined by “|” operator in order to fetch more then one property (or just sum flag values, e.g. to load both pictures and search tags you need to sum ProductImages + SearchTags that is 128+8=136)

So minimal request to specify product entity properties to load will be :

{ "propertiesToLoad":{ "value":64 // product category in this case }, "offset":0, "count":10, "sortInfo": [] }

Organizational unit - specific product data

In order to specify which organizational unit - specific data should be fetched for products in GetProductPage request is need to be defined property [organizationalUnitPropertiesRequest].

ProductOrganizationalUnitPropertiesRequest is an entity which consists of 2 properties: organizationalUnitIds which is array of organizational unit ids for which data is needed and PropertiesToLoad property of type ProductOrganizationalUnitPropertiesToLoad in which may be specified which exactly organizational-unit data is needed.

ProductOrganizationalUnitPropertiesToLoad is flag enum with following values:

  • CurrentSalesPrice = 1,

  • CurrentSalesPriceWithoutVat = 2,

  • SalesPrices = 4,

  • Availability = 8,

  • OverridableProperties = 16

Flags may be combined by “|” operator in order to fetch more then one property.

So minimal request to specify organizational unit - specific product data will be:

{ "organizationalUnitPropertiesRequest":{ "value":{ "organizationalUnitIds":[ -1, 1, 2 ], "propertiesToLoad":4 // sales prices in this case } }, "offset":0, "count":10, "sortInfo": [] }

Product location - specific product data

In order to specify which product location - specific data should be fetched for products in GetProductPage request is need to be defined property [locationPropertiesRequest].

ProductProductLocationPropertiesRequestis an entity which consists of 2 properties: ProductLocationIds which is array of product locationids for which data is needed and PropertiesToLoad property of type ProductLocationDataPropertiesToLoadin which may be specified which exactly product location data is needed.

ProductOrganizationalUnitPropertiesToLoad is flag enum with following values:

  • Availability = 1

Flags may be combined by “|” operator in order to fetch more then one property.

So minimal request fetch specify product location - specific product data (availability in this case) will be:

Other product page entry properties

Set of other product page entry properties that are part of product page entry but not a part of product entity itself but may be included in response as part of ProductPageEntry may be defined [pageEntryPropertiesToLoad] property of request. This is a flag enum of type ProductPageEntryProperties with following values:

  • CurrentSalesPrice = 1,

  • SalesPrices = 2,

  • ModificationInfo = 4,

  • PurchaseQuantitySettings = 8,

  • CurrentSalesPriceWithoutVat = 16,

  • OverridableProperties = 32

Flags may be combined by “|” operator in order to fetch more then one property.

So minimal request to specify additional product properties to load will be:

Filtering

Basic filtering

Basic and commonly used filters are described below:

[modifiedAfter] indicate that we need all products that were modified after specific date. In case when we are need all products - this field should be null.

Each product have properties [isProductInstancesSupported][isProductVariantsSupported], and [productImages] that need to be analyzed in order to fetch additional product data.

If [isProductInstancesSupported]  is true, variants for products need to be fetched,
If [isProductVariantsSupported]  is true, product instances need to be fetched,
If collection of [productImages] is not empty - product image files may be fetched.

Filter by product location availability

To filter products by availability in specific product locations need to be specified property [AvailabilityInLocationFilters]. It is collection of objects of type ProductAvailabilityInLocationFilterModel, on per location to filter in each of them should be defined product location Id and may be defined properties [stockCountRange] or [availableCountRange] for that location. For example, if need to be fetched products that have products in stock, should be defined StockCountRange which value of property [from] = 0.1 (min quantity.

Below is presented minimal request to fetch products that are available in specific location. Please note that In this request also defined [locationPropertiesRequest] because there is a common case when user need to fetch products that are available in product location and also he need to know how many items are exactly available in location.