Property Resource
Content
- Get Product Properties
- Get Product Property
- Create Product Property
- Update Product Property
- Bulk Create or Update Product Properties
- Delete Product Properties
Get Product Properties
GET /api/products/1/properties.json
- GET /api/products/1/properties.json will return the first 150 (default limit) product properties. You can increase the limit to a maximum of 250 product properties.
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/1/properties.json
Status: 200 OK [ { "property": { "adjustable_id": 1, "adjustable_type": "Product", "handle": "color", "id": 100, "is_visible": true, "key": "Color", "position": 0, "value": "black" } }, { "property": { "adjustable_id": 1, "adjustable_type": "Product", "handle": "length", "id": 101, "is_visible": true, "key": "Length", "position": 1, "value": "686 mm" } }, { "property": { "adjustable_id": 1, "adjustable_type": "Product", "handle": "height", "id": 102, "is_visible": true, "key": "Height", "position": 2, "value": "128 mm" } }, { "property": { "adjustable_id": 1, "adjustable_type": "Product", "handle": "css-class", "id": 103, "is_visible": false, "key": "css-class", "position": null, "value": "awesome" } } ]
Get Product Property
GET /api/products/1/properties/100.json
- GET /api/products/1/properties/100.json will return the specified product property.
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/1/properties/100.json
Status: 200 OK { "property": { "adjustable_id": 1, "adjustable_type": "Product", "handle": "color", "id": 100, "is_visible": true, "key": "Color", "position": 0, "value": "black" } }
Create Product Property
POST /api/products/1/properties.json
- POST /api/products/1/properties.json will create a new product property 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 \ '{ "property": { "key": "Color", "value": "black" } }' \ https://shop_subdomain.versacommerce.de/api/products/1/properties.json
Status: 201 Created { "property": { "key": "Color", "value": "black" } }
See the Get Product Property endpoint for more info about the output.
Update Product Property
PUT /api/products/1/properties/100.json
- PUT /api/products/1/properties/100.json will update the product property 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 \ '{ "property": { "key": "Color", "value": "White" } }' \ https//shop_subdomain.versacommerce.de/api/products/1/properties/100.json
Status: 200 OK { "property": { "key": "Color", "value": "white" } }
Bulk Create or Update Product Properties
PUT /api/products/1.json
- PUT /api/products/1.json will add or update the product properties 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": { "properties": [{ "key": "Color", "value": "black" }, { "key": "Length", "value": "686 mm" }, { "key": "Height", "value": "128 mm" }, { "key": "css-class", "value": "awesome", "is_visible": false } ] } }' \ https://shop_subdomain.versacommerce.de/api/products/1.json
Status: 200 OK { "product": { "properties": [{ "key": "Color", "value": "black" }, { "key": "Length", "value": "686 mm" }, { "key": "Height", "value": "128 mm" }, { "key": "css-class", "value": "awesome", "is_visible": false } ] } }
See the Get Product endpoint for more info about the output.
Delete Product Properties
DELETE /api/products/1/properties/100.json
- DELETE /api/products/1/properties/100.json will delete the property 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/1/properties/100.json Status: 200 OK