Could anyone help me to find the rest api to get hex or image of visual swatch attribute?
I need the api to return the following,
Label
Value
HEX or Image of the swatch.
Thanks
apicolor-swatchesmagento-2.1rest
Could anyone help me to find the rest api to get hex or image of visual swatch attribute?
I need the api to return the following,
Label
Value
HEX or Image of the swatch.
Thanks
Best Answer
Unfortunatly I didn't find any API to get hex or image of visual swatch attribute. After playing a bit i write a module which use extension attribute for AttributeInterface.... I've tried with AttributeOptionInterface but without success.
After the module is installed is possible to fetch hex or image by checking the extension_attributes for these API calls:
Tested with Magento 2.3.2
app/code/ProjectName/ModuleName/registration.php
app/code/ProjectName/ModuleName/etc/module.xml
app/code/ProjectName/ModuleName/etc/extension_attributes.xml
Create AttributeSwatchOptionInterface and Model
app/code/ProjectName/ModuleName/Api/Data/AttributeSwatchOptionInterface.php
app/code/ProjectName/ModuleName/Model/AttributeSwatchOption.php
Now we add an observe for event catalog_entity_attribute_load_after
app/code/ProjectName/ModuleName/etc/events.xml
app/code/ProjectName/ModuleName/Observer/OptionSwatchLoadAfter.php