Retrieving image data via API
-
Hey, currently we’re creating products and its variants via WooCommerce API but when we create some colors (an attribute) for our products, it doesn’t have any image so it’s impossible to change between colors in the web.
We’ve already tried by retrieving the product attributes to see if there’s any attribute in the response that we can use but there’s none even when we upload the image to an attribute manually via web.
When we try with this url: v3/products/attributes/2/terms/365 (last parameter is an id)
It retrieves:{ "id": 365, "name": "2022289600", "slug": "2022289600", "description": "2022289600", "menu_order": 0, "count": 1, "_links": { "self": [ { "href": "https://sm.nhubex.com:8088/index.php/wp-json/wc/v3/products/attributes/2/terms/365" } ], "collection": [ { "href": "https://sm.nhubex.com:8088/index.php/wp-json/wc/v3/products/attributes/2/terms" } ] } }
When we create the product, this is the attributes we send:
"attributes": [ { "id": "2", "name": "Color", "position": "0", "visible": true, "variation": true, "options": [ "600", "001" ] } ]
And creating the variation:
"attributes": [ { "id": "2", "option": "2022289600", "image": [ { "id": 12039 } ] }
In this one we tried to send some new attribute called “image” in the json but it doesn’t work.
Where can I send the thumbnail image to update it? Is there any metadata attribute that I can use for sending that attribute image?
- The topic ‘Retrieving image data via API’ is closed to new replies.