Viewing Products
Listing Buyer Products
Let's retrieve a list of products available to our buyer user.
Get a list of buyer products
1GET https://sandboxapi.ordercloud.io/v1/me/products HTTP/1.12Authorization: Bearer INSERT_ACCESS_TOKEN_HERE3Content-Type: application/json; charset=UTF-8;
Notice we did not pass any parameters yet. Your response should look something like this:
1{2 "Meta": {3 "Facets": [],4 "Page": 1,5 "PageSize": 20,6 "TotalCount": 1,7 "TotalPages": 1,8 "ItemRange": [9 1,10 111 ]12 },13 "Items": [14 {15 "PriceSchedule": {16 "ID": "SHIRT_PRICE",17 "Name": "Cotton T-Shirt Price",18 "ApplyTax": false,19 "ApplyShipping": false,20 "MinQuantity": 1,21 "MaxQuantity": null,22 "UseCumulativeQuantity": false,23 "RestrictedQuantity": false,24 "PriceBreaks": [25 {26 "Quantity": 1,27 "Price": 1028 }29 ],30 "xp": null31 },32 "ID": "SHIRT",33 "Name": "Cotton T-Shirt",34 "Description": "A plain white, cotton shirt for everyday use.",35 "QuantityMultiplier": 1,36 "ShipWeight": null,37 "ShipHeight": null,38 "ShipWidth": null,39 "ShipLength": null,40 "Active": true,41 "SpecCount": 0,42 "VariantCount": 0,43 "ShipFromAddressID": null,44 "Inventory": null,45 "DefaultSupplierID": null,46 "AllSuppliersCanSell": false,47 "xp": null48 }49 ]50}
As you can see, OrderCloud has flattened out the relationships between our buyer user and the SHIRT
product. The buyer user's organization, BUYER_ORGANIZATION
, has the default catalog BUYER_ORGANIZATION
, which has the SHIRT
product assigned to it with a default price schedule of SHIRT_PRICE
.
Buyer Product Model
My Products introduces a new OrderCloud model called BuyerProduct
here. This type of product has a price schedule attached as a sub-object, allowing developers quick access to pricing information without needing to make additional API calls.
List Page with Facets
Another interesting part of this response model is the Facets
property within the Meta
information. Facets are unique to resources that have been enhanced with elastic search in OrderCloud's backend. This topic is covered in other reading.
Browsing Other Catalogs
The buyer product list request provides a way for buyer users to browse other product catalogs (when assigned to more than just their organizations default catalog). This can be done using the CatalogID
option.
Browsing by Category
If one of these other catalogs had categories in it, one would be able to filter buyer products by category using the CategoryID
property.
Creating a unique experience entirely depends on how you take advantage of the parameters available to you. You can create a faceted product search, a category browse experience, or something completely custom using advanced querying.
Still have questions?
Ask in our Community Channel