Skip to main content

GetProductPage Usage

Method allows fetching products in a paginated way. It may be configured in various ways to fetch a specific subset of product information using specific filters.

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

Method returns a page of objects of type ProductPageEntry that contains the following properties:

  • Product - The product itself. Its content is defined by property PropertiesToLoad of request.
  • OrganizationalUnitProperties - Contains a collection of organizational unit-specific product data. Their content is defined by property OrganizationalUnitPropertiesRequest of request.
  • ProductLocationData - Contains a collection of product location-specific 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 by property [PageEntryPropertiesToLoad] of request.

Configure Scope of Data to Load

Properties of Product

A set of properties of a product to be loaded may be specified in [propertiesToLoad] property of the request. This is a flag enum of type ProductProperties with the 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 using the | operator to fetch multiple properties, or by summing flag values (e.g. to load both pictures and search tags you need to sum ProductImages + SearchTags that is 128+8=136).

Minimal request example to specify product entity properties:

{
"propertiesToLoad": {
"value": 64
},
"offset": 0,
"count": 10,
"sortInfo": []
}

Organizational Unit-Specific Product Data

To specify which organizational unit-specific data should be fetched for products in GetProductPage request, define property organizationalUnitPropertiesRequest.

ProductOrganizationalUnitPropertiesRequest consists of two properties:

  • organizationalUnitIds: Array of organizational unit IDs.
  • PropertiesToLoad: Enum of type ProductOrganizationalUnitPropertiesToLoad.
CurrentSalesPrice = 1,
CurrentSalesPriceWithoutVat = 2,
SalesPrices = 4,
Availability = 8,
OverridableProperties = 16

Minimal request example:

{
"organizationalUnitPropertiesRequest": {
"value": {
"organizationalUnitIds": [-1, 1, 2],
"propertiesToLoad": 4
}
},
"offset": 0,
"count": 10,
"sortInfo": []
}

Product Location

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

ProductProductLocationPropertiesRequest is 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

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

{
"locationPropertiesRequest": {
"value": {
"productLocationIds": [2],
"propertiesToLoad": 1
}
},
"offset": 0,
"count": 10,
"sortInfo": []
}

Other Product Page Entry Properties

Set of other product page entry properties that are part of product page entry, 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

Minimal request example:

{
"pageEntryPropertiesToLoad": {
"value": 2
},
"offset": 0,
"count": 10,
"sortInfo": []
}

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 the minimal request to fetch products available at a specific location. Note that in this request, locationPropertiesRequest is also defined, as it is common for users to retrieve products available at a given location while also determining the exact number of available items.

{
"availabilityInLocationFilters": {
"value": [
{
"productLocationId": 2,
"stockCountRange": {
"value": {
"from": -100.1,
"to": null
}
}
}
]
},
"locationPropertiesRequest": {
"value": {
"productLocationIds": [2],
"propertiesToLoad": 1
}
},
"offset": 0,
"count": 10,
"sortInfo": []
}