Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Get and create images for a specific product #42

Merged
merged 1 commit into from

2 participants

Sebastian Szturo Mark Rickerby
Sebastian Szturo

Added 2 methods to get and create images for a specific product.

GET /products/id/images.json
POST /products/id/images.json

The problem is the naming of the method "get_product_images" and "create_product_images" aren't quite right because all product resources are named plural. But I don't really know how to name them.

This should be added for every product specific resource like videos or discount rules.

Mark Rickerby

Those methods are named correctly—it should be plural for a collection resource (ie: /products), and singular for an entity resource (ie: /products/1).

Mark Rickerby maetl merged commit 3bd68d0 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/bigcommerce/api.rb
8 lib/bigcommerce/api.rb
View
@@ -281,6 +281,14 @@ def get_products_customfield(product_id, custom_field_id)
@connection.get("/products/#{product_id}/customfields/#{custom_field_id}", {})
end
+ def get_product_images(product_id, options={})
+ @connection.get("/products/#{product_id}/images", options)
+ end
+
+ def create_product_images(product_id, options={})
+ @connection.post("/products/#{product_id}/images", options)
+ end
+
def get_products_images(options={})
@connection.get("/products/images", options)
end
Something went wrong with that request. Please try again.