Skip to main content

Product API

note

For the Product API to work on a site, the recommendation feature must be enabled for the site. To enable the feature, if it's not already enabled, contact Frosmo support.

The Product API allows you to retrieve product data from the Frosmo back end. You can retrieve the full data for one or more products based on product IDs. To get the IDs, use the Graniitti API.

For an introduction to recommendations, see Feature: Recommendation.

Product API vs. Graniitti API

You can retrieve product data through both the Product API and the Graniitti API. Here's how the two APIs differ:

  • The Product API returns the full data for a product. The Graniitti API only returns the main details for a product, namely its ID, name, and type.

  • The Product API does not require authentication. The Graniitti API uses token-based authentication.

  • The Product API requires the ID of each product whose data to return. The Graniitti API can retrieve all products for a site (no product IDs required) or a single product based on its ID.

  • The Product API only cares about product data. The Graniitti API can additionally retrieve and manage relevant products for a modification.

In a nutshell:

  • If you want to retrieve the full data for a product, use the Product API.

  • If you want to find out the IDs of products, or if you want to map products to modifications, use the Graniitti API.

For more information about the Graniitti API, see the Graniitti API guide.

Product API vs. Frosmo data layer

The Product API returns the exact same product data you send to the Frosmo back end through the Frosmo data layer. However, the product object properties and structure differ between the data layer and the API:

  • Data layer uses the frosmoProduct prefix for all product object properties. For example: frosmoProductId and frosmoProductName

  • Product API omits the prefix in the returned product data. For example: id and name

  • frosmoProductCategory in the data layer maps to type in the Product API.

  • Data layer uses a flat object structure. The Product API nests all product data under the attributes property, except id, name, and type, which are returned in the product object root.

For more information about the data layer and its product object model, see Frosmo data layer and Tracking products with the data layer.