Dokumentation Entwickler API

Product Ressource

Aktualisiert am 11.10.2017

Product Ressource

Product Associations

Create Product

POST /api/products.json

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

Example

Product Ressource

$ 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
}
}' \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products.json

Product Ressource

Status: 201 Created

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

Product Ressource

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

Product Ressource

curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X DELETE \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products/:product_id.json

Product Ressource

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.

Product Ressource

Available Filters and Options

Filter-/Optionname Description Type
limit The amount of results, defaults to 150, maximum are 250 Integer
offset The amount of results to omit Integer
include Include one or more product associations (format: variants,properties,recommendations,product_images,…) String
show_variants Show variants as product and not as a child of a product (not nested). Boolean
category Filter by category String
vendor Filter by vendor String
code Filter by code (code is uniq, so the result count is always 1) String
title Filter by title String
subtitle Filter by subtitle String
price Filter by price BigDecimal
compare_at_price Filter by compare_at_price BigDecimal
extra_price Filter by extra_price BigDecimal
created_on Filter by product creation date (format: 2010-01-01) Date
updated_on Filter by product update date (format: 2010-01-01) Date
id_min Filter products by the minimum id Integer
id_max Filter products by the maximum id Integer
price_min Filter products by the minimum price BigDecimal
price_max Filter products by the maximum price BigDecimal
compare_at_price_min Filter products by the minimum compare at price BigDecimal
compare_at_price_max Filter products by the maximum compare at price BigDecimal
extra_price_min Filter products by the minimum extra price BigDecimal
extra_price_max Filter products by the maximum extra price BigDecimal
stock_min Filter products by the minimum stock amount Integer
stock_max Filter products by the maximum stock amount Integer
created_on_min Filter products by creation before date DateTime
created_on_max Filter products by creation after date DateTime
updated_on_min Filter products by last update before date DateTime
updated_on_max Filter products by last update after date DateTime
  • 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

Product Ressource

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

Product Ressource

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": []
}
},
...
]

Product Ressource

Get Product

GET /api/products/:product_id.json

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

Example

Product Ressource

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products/:product_id.json

Product Ressource

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": "http://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
]
}
}

Product Ressource

Get Products Count

GET /api/products/count.json

  • GET /api/products/count.json will return the products count.

Example

Product Ressource

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products/count.json

Product Ressource

Status: 200 OK

{
"count": 124
}

Product Ressource

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

Product Ressource

$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products.json

Product Ressource

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": "http://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": "http://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": [

]
}
}
]

Product Ressource

Update Product

PUT /api/products/:product_id.json

  • PUT /api/products/:product_id.json will update the product from the parameters passed.

Example

Product Ressource

$ 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
}
}' \
http://SHOP_SUBDOMAIN.versacommerce.de/api/products/:product_id.json

Product Ressource

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

Product Ressource

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