IMPORTANT NOTE ABOUT ATTRIBUTE DEFINITIONS: Attribute IDs are different for each account. Please use with caution.
To set attributes, first you must list attributes defined in the account:
curl -X POST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{}' 'https://api.retailops.com/config/attribute/fetch~1.json'
This returns a list of all attributes defined on the account
Setting Product Family attributes
The Product Family API uses an "id" which is the same as the displayed Product Family ID You can set attributes on the family directly with this ID in the "id" field.
You may set any number of attributes on a product family with a single call. The Product Family API does not support setting attributes on multiple Product Families via a single call.
Examples of setting Product Family Attributes:
Setting a Price Attribute on Product Family 123
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"family_id":"123","values":{},"attr_values":[{"attribute_id":21,"v":{"obj":{"simple":"59.9500"}}}]}' 'https://api.retailops.com/product/family/save~1.json'
Setting a Text Attribute on a Product Family 123
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"family_id":"123","values":{},"attr_values":[{"attribute_id":22,"v":{"val": "ABC"}}]}' 'https://api.retailops.com/product/family/save~1.json'
Setting a Select/Multiselect Attribute on Product Family 123
First you have to retrieve the list of values for that attribute:
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"attribute_id":23}' 'https://api.retailops.com/config/attribute/value/list~1.json'
Returns list of values associated with select attribute (attribute_id 23) - lets choose value id 999, which might correspond to "Blue"
Then set the value id for that attribute
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"family_id":"123","values":{},"attr_values":[{"attribute_id":23,"v":[{"id":"999"}]}]}' 'https://api.retailops.com/product/family/save~1.json'
Setting SKU attributes
The SKU API uses a SKU id field which is different than the SKU number displayed in the User interface We have to retrieve the sku_id for SKU Number "12345" (Can retrieve up to 1000 SKU records per call)
Note: You can include "with_attrs": 1 in this call to include attribute data in the response
curl -X POST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"sku_string":["1000"]}' 'https://api.retailops.com/product/sku/search~1.json'
Which returns sku_id ("id") 98765 for example
Once you have the attribute id, and the SKU "id" you can do one of the following: Note: You may set any number of attributes on a SKU, and you may update a maximum of 1,000 skus in a single call.
Setting a (simple) Price Attribute on SKU 1000 ( sku_id 98765 )
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"records":{"id":"98765","attr_values":[{"attribute_id":21,"v":{"obj":{"simple":"59.9500"}}}]}}' 'https://api.retailops.com/product/sku/save~1.json'
Setting a Text Attribute on SKU 1000 ( sku_id 98765 )
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"records":[{"id":"98765","attr_values":[{"attribute_id":22,"v":{"val": "ABC"}}]}]}' 'https://api.retailops.com/product/sku/save~1.json'
Setting a Select/Multiselect Attribute on SKU 1000 ( sku_id 98765 )
First you have to retrieve the list of values for that attribute:
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"attribute_id":23}' 'https://api.retailops.com/config/attribute/value/list~1.json' # Returns list of values associated with that select attribute
Then set the value id for that attribute
curl -XPOST -Hapikey:YOUR_APIKEY_HERE -H content-type:application/json -d '{"records":{"id":"98765","attr_values":[{"attribute_id":23,"v":[{"id":"999"}]}]}}' 'https://api.retailops.com/product/sku/save~1.json'
Comments
0 comments
Please sign in to leave a comment.