Skip to content

BigCommerce

This recipe puts each frame you approve in Shootika on the matching BigCommerce product. It follows the pattern every recipe shares; this page covers the BigCommerce side.

You need:

  • a Shootika API key (see Authentication);
  • a BigCommerce store API account whose Products scope is modify, and its access token;
  • your store hash, the store’s id in the API address.

The access token is sent in the X-Auth-Token header.

Terminal window
export BC_STORE_HASH="your store hash"
export BC_ACCESS_TOKEN="your access token"

When you create the product in Shootika, put the BigCommerce product id in external_id. For BigCommerce product 1042:

Terminal window
curl https://api.shootika.com/v1/products \
-H "Authorization: Bearer $SHOOTIKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Ribbed crew sweater",
"garment_category": "tops",
"external_id": "1042",
"image_urls": ["https://example.com/photos/sweater-flat.jpg"]
}'

Then shoot, and review the frames in Shootika, as in the pattern.

Read every page of the approved frames, starting with PAGE=1:

Terminal window
curl "https://api.shootika.com/v1/frames?approved=true&page=$PAGE&page_size=100" \
-H "Authorization: Bearer $SHOOTIKA_API_KEY"

Add one to PAGE and ask again until page times page_size reaches total. The list is newest first, so a frame shot weeks ago and approved today can be on a later page; reading only the first page misses it. Compare every frame id against your record of published frames. To check one product, add &product_id= with its Shootika id instead.

For each frame you have not published yet, keep its image.url and read its product’s external_id:

Terminal window
curl https://api.shootika.com/v1/products/$PRODUCT_ID \
-H "Authorization: Bearer $SHOOTIKA_API_KEY"
Terminal window
BC_PRODUCT_ID="the product's external_id"
FRAME_URL="the frame's image.url"

Create one product image from the frame’s address:

Terminal window
curl "https://api.bigcommerce.com/stores/$BC_STORE_HASH/v3/catalog/products/$BC_PRODUCT_ID/images" \
-H "X-Auth-Token: $BC_ACCESS_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"image_url\": \"$FRAME_URL\", \"is_thumbnail\": false, \"description\": \"Ribbed crew sweater, worn by a model\"}"
  • Each call adds one image to the product.
  • BigCommerce downloads a copy of the image and serves it from its own CDN, so your store keeps its own copy.
  • Send "is_thumbnail": true to make the frame the product’s thumbnail, the image shown in category pages and search results. sort_order sets its place on the product page.
  • BigCommerce takes an image_url of up to 255 characters, and an image of up to 8 MB.

When the answer is 200, keep the new image’s id, data.id, with the frame id, and record the frame as published.

If someone takes the frame’s approval down in Shootika, your BigCommerce product keeps the image. Delete it with the image id you kept:

Terminal window
curl -X DELETE "https://api.bigcommerce.com/stores/$BC_STORE_HASH/v3/catalog/products/$BC_PRODUCT_ID/images/$BC_IMAGE_ID" \
-H "X-Auth-Token: $BC_ACCESS_TOKEN"