Lab - Metafields and Product Reviews

Plan: Developer Foundations

Lesson 18 of 21 · 30 min

This lab activity will give you a chance to practice working with metafields and product reviews via the Catalog API. Each step will walk you through how to use all of the endpoints covered in the previous lesson.

Prerequisites:

  • BigCommerce store (sandbox or live)
  • Basic knowledge of APIs
  • REST client (Postman)
  • Completion of all previous Catalog API labs

In this lab, you will:

  • Add a metafield to a product
  • GET metafields by product ID
  • Create a product review
  • GET product reviews

Add a Metafield to a Product

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/metafields
  1. Enter the ID of the product created in previous lab for product_id in the Params tab
  2. Copy and paste the code below into the Body section of Postman
{
"permission_set": "app_only",
"namespace": "App Namespace",
"key": "location_id",
"value": "Shelf 3, Bin 5",
"description": "Where products are located"
}
  1. Select POST next to the request url
  2. Click the Send button
  3. Observe response and metafield added to product

GET Metafields

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/metafields
  1. Enter the ID of the product created in previous lab for product_id in the Params tab
  2. Select GET next to the request url (if not already selected)
  3. Click the Send button
  4. Observe response

Create a Product Review

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/reviews
  1. Enter the ID of the product created in previous lab for product_id in the Params tab
  2. Copy and paste the code below into the Body section of Postman
{
"title": "Great Product",
"text": "This shirt is awesome!",
"status": "approved",
"rating": 5,
"email": "janedoe@email.com",
"name": "Jane Doe",
"date_reviewed": "2019-03-21T19:37:13+00:00"
}
  1. Select POST next to the request url
  2. Click the Send button
  3. Observe response and review added to product

GET Product Reviews

  1. Copy andpaste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/reviews
  1. Enter the ID of the product created in previous lab for product_id in the Params tab
  2. Select GET next to the request url
  3. Click the Send button
  4. Observe response