Preview Changes will not be visible to customers until published.

Product Resource

Content

Product Associations


Create Product

POST /api/products.json

  • POST /api/products.json will create a new product from the parameters passed.

Example:

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X POST \
-d \
'{
"product": {
"title": "This is my new product!",
"code": "my-new-product"
}
}' \
https://shop_subdomain.versacommerce.de/api/products.json
Status: 201 Created

{
  "product": {
    "title": "This is my new product!",
    "code": "my-new-product"
  }
}

See the Get Product endpoint for more info about the output.


Delete Product

DELETE /api/products/:product_id.json
  • DELETE /api/products/:product_id.json will delete the product specified and return 200 OK if that was successful.
Example:
curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X DELETE \
https://shop_subdomain.versacommerce.de/api/products/:product_id.json

Status: 200 OK

Filter Products

GET /api/products.json?filter_name1=filter_value1&filter_name2=filter_value2

  • GET /api/products.json?filter_name_1=filter_value_1&filter_name_2=filter_value_2 will return a filtered list of products. See the Get Products endpoint for more info about the output.

Available Filters and Options

Filter-/Optionname Description Type Parameter
limit The amount of results, defaults to 150, maximum are 250 Integer limit=10
offset The amount of results to omit Integer offset=10
include Include one or more product associations (format: variants, properties, recommendations, product_images, …) String include=items
show_variants Show variants as product and not as a child of a product (not nested). Boolean show_variant=true
category Filter by category String category=electronics
vendor Filter by vendor String vendor=vendorname
code Filter by Article number (Article number is unique, so the result is always a single product) String code=sample_code_001
title Filter by title String title=product_title
subtitle Filter by subtitle String subtitle=product_subtitle
price Filter by price BigDecimal price=100.0
compare_at_price Filter by compare_at_price BigDecimal compare_at_price=100.0
extra_price Filter by extra_price BigDecimal extra_price=100.0
created_on Filter by product creation date Date created_on= 2019-12-31
updated_on Filter by product update date Date updated_on= 2019-12-31
id_min Filter products by the minimum id Integer id_min=10
id_max Filter products by the maximum id Integer id_max=10
price_min Filter products by the minimum price BigDecimal price_min=100.0
price_max Filter products by the maximum price BigDecimal price_max=100.
compare_at_price_min Filter products by the minimum compare at price BigDecimal compare_at_price_min =100.0
compare_at_price_max Filter products by the maximum compare at price BigDecimal compare_at_price_max =100.0
extra_price_min Filter products by the minimum extra price BigDecimal extra_price_min=100.0
extra_price_max Filter products by the maximum extra price BigDecimal extra_price_max=100.0
stock_min Filter products by the minimum stock amount Integer stock_min=10
stock_max Filter products by the maximum stock amount Integer stock_max=10
created_on_min Filter to show products created after date DateTime created_on_min= 2019-12-31
created_on_max Filter to show products created before date DateTime created_on_max= 2019-12-31
updated_on_min Filter to show products updated after date DateTime updated_on_min= 2019-12-31
updated_on_max Filter to show products updated before date DateTime updated_on_max= 2019-12-31
  • GET /api/products.json?include=variants&show_variants=true will return all products and variants (not nested). See the Get Products endpoint for more info about the output.

Example:

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/products.json?include=variants&show_variants=true
Status: 200 OK

[
  {
    "product": {
      "active": true,
      ...
      "id": 127258,
      ...
      "product_id": null,
      ...
      "variant_ids": [
        127250,
        127259
      ]
    }
  },
  {
    "product": {
      "active": true,
      ...
      "id": 127250,
      ...
      "product_id": 127258,
      ...
      "variants_count": 0,
      "variant_ids": []
    }
  },
  {
    "product": {
      "active": true,
      ...
      "id": 127259,
      ...
      "product_id": 127258,
      ....
      "variants_count": 0,
      "variant_ids": []
    }
  },
  ...
]

Get Product

GET /api/products/:product_id.json

  • GET /api/products/:product_id.json will return the specified product.

Example:

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/products/:product_id.json
Status: 200 OK

{
  "product": {
    "active": true,
    "base_perform_calculation": false,
    "base_quantity": 1,
    "base_quantity_package": 1,
    "base_quantity_sold": 1,
    "base_unit": "Piece",
    "boolean_option_01": false,
    "calculates_shipping_cost": true,
    "category": "Technology",
    "category_handle": "technology",
    "code": " 4988028120657",
    "compare_at_price": "0.0",
    "considers_stock": false,
    "content_meta_description": null,
    "content_meta_keywords": null,
    "content_title_tag": null,
    "created_on": "2011-10-17T02:00:00+02:00",
    "custom_url": null,
    "custom_url_routing": "standard_url_is_canonical",
    "date_option_01": null,
    "date_option_02": null,
    "description": "My product description...",
    "description_html": "My product description...",
    "extra_price": "0.0",
    "featured": false,
    "featured_image_url": "https://assets.versacommerce.de/my-shop_versacommerce_de/product_images/117/original/my_image.jpg",
    "format": "tinymce",
    "handle": "deh-6300sd",
    "id": 117,
    "new": false,
    "note": null,
    "option_01": "",
    "option_02": "",
    "option_03": "",
    "packaging_duration": 0,
    "position": null,
    "price": "129.0",
    "product_id": null,
    "product_images_count": 4,
    "properties_count": 2,
    "shop_id": 953,
    "shows_stock_amount": false,
    "stock": 0,
    "subtitle": null,
    "tag_list": "Audio,Car,Technology,Amplifier",
    "tags_count": 9,
    "tax_category": "standard",
    "title": "DEH-6300SD",
    "updated_on": "2012-01-31T01:00:00+01:00",
    "vendor": "Pioneer",
    "vendor_handle": "pioneer",
    "visible": true,
    "weight": 0,
    "variants_count": 2,
    "url": "/products/deh-6300sd",
    "variant_ids": [
      118,
      119
    ]
  }
}

Get Products Count

GET /api/products/count.json

  • GET /api/products/count.json will return the products count.
Example:
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/products/count.json
Status: 200 OK

{
  "count": 124
}

Get Products

GET /api/products.json

  • GET /api/products.json will return the first 150 (default limit) products. You can increase the limit to a maximum of 250 products. See the Filter Products endpoint for more info.

Example:

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/products.json
Status: 200 OK

[
  {
    "product": {
      "active": true,
      "base_perform_calculation": false,
      "base_quantity": 1,
      "base_quantity_package": 1,
      "base_quantity_sold": 1,
      "base_unit": "Piece",
      "boolean_option_01": false,
      "calculates_shipping_cost": true,
      "category": "Fashion",
      "category_handle": "fashion",
      "code": "dress-001",
      "compare_at_price": "19.95",
      "considers_stock": true,
      "content_meta_description": null,
      "content_meta_keywords": null,
      "content_title_tag": null,
      "created_on": "2011-10-07T02:00:00+02:00",
      "custom_url": null,
      "custom_url_routing": "standard_url_is_canonical",
      "date_option_01": null,
      "date_option_02": null,
      "description": "My product description...",
      "description_html": "My product description...",
      "extra_price": "0.0",
      "featured": true,
      "featured_image_url": "https://assets.versacommerce.de/my-shop_versacommerce_de/product_images/100/original/my_image.jpg",
      "format": "tinymce",
      "handle": "jersey-dress-now-for-a-special-price",
      "id": 100,
      "new": false,
      "note": null,
      "option_01": null,
      "option_02": null,
      "option_03": null,
      "packaging_duration": 4,
      "position": null,
      "price": "12.0",
      "product_id": null,
      "product_images_count": 6,
      "properties_count": 4,
      "shop_id": 953,
      "shows_stock_amount": true,
      "stock": 2,
      "subtitle": "Now for a special price!",
      "tag_list": "Blue,Dress",
      "tags_count": 5,
      "tax_category": "standard",
      "title": "Jersey dress",
      "updated_on": "2013-09-28T16:57:01+02:00",
      "vendor": "Promod",
      "vendor_handle": "promod",
      "visible": true,
      "weight": 0,
      "variants_count": 2,
      "url": "/products/jersey-dress-now-for-a-special-price",
      "variant_ids": [
        101,
        102
      ]
    }
  },
  {
    "product": {
      "active": true,
      "base_perform_calculation": false,
      "base_quantity": 1,
      "base_quantity_package": 1,
      "base_quantity_sold": 1,
      "base_unit": "Piece",
      "boolean_option_01": false,
      "calculates_shipping_cost": true,
      "category": "Fashion",
      "category_handle": "fashion",
      "code": "dress-002",
      "compare_at_price": "39.95",
      "considers_stock": true,
      "content_meta_description": null,
      "content_meta_keywords": null,
      "content_title_tag": null,
      "created_on": "2011-10-07T02:00:00+02:00",
      "custom_url": null,
      "custom_url_routing": "standard_url_is_canonical",
      "date_option_01": null,
      "date_option_02": null,
      "description": "My product description...",
      "description_html": "My product description...",
      "extra_price": "0.0",
      "featured": false,
      "featured_image_url": "https://assets.versacommerce.de/my-shop_versacommerce_de/product_images/103/original/my_image_2_.jpg",
      "format": "tinymce",
      "handle": "knee-length-modest-neckline-dress",
      "id": 103,
      "new": true,
      "note": null,
      "option_01": null,
      "option_02": null,
      "option_03": null,
      "packaging_duration": 0,
      "position": null,
      "price": "20.0",
      "product_id": null,
      "product_images_count": 4,
      "properties_count": 4,
      "shop_id": 953,
      "shows_stock_amount": true,
      "stock": 1,
      "subtitle": null,
      "tag_list": "Red,Dress",
      "tags_count": 8,
      "tax_category": "standard",
      "title": "Knee Length Modest Neckline Dress",
      "updated_on": "2011-10-07T02:00:00+02:00",
      "vendor": "XOXO",
      "vendor_handle": "xoxo",
      "visible": true,
      "weight": 0,
      "variants_count": 0,
      "url": "/products/knee-length-modest-neckline-dress",
      "variant_ids": []
    }
  }
]

Update Product

PUT /api/products/:product_id.json

  • PUT /api/products/:product_id.json will update the product from the parameters passed.
Example:
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X PUT \
-d \
'{
"product": {
"title": "This is my new product title!",
"code": "my-new-product-code"
}
}' \
https://shop_subdomain.versacommerce.de/api/products/:product_id.json
Status: 200 OK

{
  "product": {
    "title": "This is my new product title!",
    "code": "my-new-product-code"
  }
}

See the Get Product endpoint for more info about the output.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.