Lab - Images, Videos, and Custom Fields

Plan: Developer Foundations

Lesson 12 of 21 · 30 min

This lab activity will give you a chance to practice working with product images, videos, and custom fields 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 Catalog API previous labs

In this lab, you will:

  • Add an image to a product
  • Add a video to a product
  • Add a custom field to a product

Add an Image to a Product

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/images
  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
{
"image_url": "https://printify.com/wp-content/uploads/2020/03/Asset-125@4x.png"
}
  1. Select POST next to the request url
  2. Click the Send button
  3. Observe response and image added to product

Image added to product

Add a Video to a Product

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/videos
  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": "Your Video",
"description": "Product Video",
"sort_order": 1,
"type": "youtube",
"video_id": "Qi6SH5ePc3Q"
}

The video_id is the ID of the video on a host site. The full URL for the video in this example is https://www.youtube.com/watch?v=Qi6SH5ePc3Q, but the request only needs the video_id which is Qi6SH5ePc3Q.

  1. Select POST next to the request url
  2. Click the Send button
  3. Observe response and video added to product

Add a Custom Field to a Product

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products/:product_id/custom-fields
  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
{
"name": "Material",
"value": "100% Cotton"
}
  1. Select POST next to the request url
  2. Click the Send button
  3. Observe response and custom field added to product