This guide demonstrates how to interact with product features using the Venddor API. Product features allow you to define specific characteristics of your products.
To retrieve the features associated with a specific product, use the GET method with the product ID:
Retrieves all features associated with the specified product.
curl -X GET 'https://www.venddor.com.br/api/products/14/features'
This request returns all features for the product with product_id=14
.
When creating a new product, you can simultaneously define its features:
Creates a new product with specified features.
This example demonstrates adding a text feature (type "T") with feature_id=23
to a new product:
curl --header 'Content-type: application/json' -X POST 'https://www.venddor.com.br/api/products' --data-binary '{ "product": "New Product", "category_ids": "223", "main_category": "223", "price": "10", "status": "A", "product_features": { "23": { "feature_type": "T", "value": "Test" } } }'
This request creates a new product with the text feature value set to "Test".
{ "product_id": 250 }
To update an existing product's features, use the PUT method:
Updates the features of an existing product.
curl --header 'Content-type: application/json' -X PUT 'https://www.venddor.com.br/api/products/250' --data-binary '{ "product_features": { "23": { "feature_type": "T", "value": "Feature updated" } } }'
This request updates the product with product_id=250
, changing the value of the text feature with feature_id=23
to "Feature updated".
{ "product_id": 250 }