- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2020
02:21 AM
04-28-2020
02:21 AM
API: add new text swatch
Hello,
I want to create for products new attributes per API.
/rest/default/V1/products/attributes
Is this for creating new attributes?
Example:
I have Attribute set "Video" (ID:10)
in this I want to add in the group "Attributes" new attributes:
pixel_format
screen_size
I can create "pixel_format" with:
[POST] /rest/default/V1/products/attributes
But how I can add the Text swatches? And how can I link this attribute to the correct attribute group?
Thank you!
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020
11:26 PM
04-29-2020
11:26 PM
Re: API: add new text swatch
Hello,
I found now:
/rest/default/V1/products/attributes/{attributeCode}/options
with the payload:
{ "option": { "label": "red", "value": "red_default", "is_default": "false", "sort_order": 0, "store_labels": [ { "store_id": 1, "label": "red en" }, { "store_id": 2, "label": "red de" } ] } }
response:
"id_5476"
in admin:
so far, ok.
But when I read the options:
[ { "label": " ", "value": "" }, { "label": "21/1.7” 12 Megapixel Progressiv CMOS", "value": "5431" }, { "label": "red en", "value": "5476" } ]
he return the first store label and the id(!)
the id(swatch) was "red_default"
Wow can I get from id 5476 the text "red_default"?