Managing Product Features in Venddor IO

Accessing Product Features

Venddor IO provides a systematic way to access and manipulate product features:

All Product Features

Endpoint: http://example.com/api/features
Methods: GET and POST

Specific Product Feature

Endpoint: http://example.com/api/features/:id
Methods: GET, PUT, and DELETE

Features of a Particular Product

Endpoint: http://example.com/api/products/:id/features
Method: GET

Using Pagination

If you're looking to access a defined set of features or a specific page of features, you can leverage the pagination parameters:

For instance:

Product Feature Attributes

Every product feature in Venddor IO is described by specific attributes or fields. Here's a brief look:

For a detailed understanding of each field and its expected values, refer to the provided table in the documentation.

Product Feature Variants

Variants describe the different options available for a product feature, especially for those that offer choices like size or color. Each variant is characterized by fields such as description, feature_id, and variant_id.

Using the API

1. Fetching All Features

curl -X GET 'http://example.com/api/features'

This returns a list of product features with their associated attributes.

2. Fetching a Specific Feature

curl -X GET 'http://example.com/api/features/14'

This provides the attributes of the product feature with feature_id=14.

3. Creating a New Feature

curl --header 'Content-type: application/json' -X POST 'http://example.com/api/features' --data-binary '{"company_id":"1", "feature_type":"C", "description":"Handmade", "status":"A"}'

This creates a new checkbox feature named "Handmade" for the store with company_id=1 and sets its status to Active.

4. Updating a Feature

curl --header 'Content-type: application/json' -X PUT 'http://example.com/api/features/22' --data-binary '{"company_id":"1", "feature_type":"S", "comparison":"Y", "variants":[{"variant": "Unique"}, {"variant": "Mass-produced"}]}'

This modifies the feature with feature_id=22 and adds two new variants: Unique and Mass-produced. It also makes this feature visible on the product comparison page.

5. Deleting a Feature

curl -X DELETE 'http://example.com/api/features/22'

This deletes the product feature with feature_id=22.

Managing Features of a Specific Product

To understand a product's features

curl -X GET 'http://example.com/api/products/14/features'

To create a new product with a specific feature

curl --header 'Content-type: application/json' -X POST 'http://example.com/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"}}}'

To update a product's specific feature

curl --header 'Content-type: application/json' -X PUT 'http://example.com/api/products/14' --data-binary '{"product_features": {"23": {"feature_type": "T", "value": "Updated Test"}}}'