I'm using Magento REST API to create products and upload images. No problems so far, but i can't find a way to set an image as the default image to be displayed on the store using the API.
Is there a way to do so without modifying magento?
I'm using Magento CE 1.9.1.0
Thanks,
Mohit Rane
2,0001 gold badge18 silver badges52 bronze badges
-
Have you tried setting its position to 0?rlecaro2– rlecaro22015年09月07日 13:44:19 +00:00Commented Sep 7, 2015 at 13:44
1 Answer 1
This is the correct way to set the image as "base", "small", "thumbnail" or "swatch".
"product" => {
"sku" => "test",
"name" => "Test Product",
"attribute_set_id" => 4,
"price" => 84,
"status" => 1,
"visibility" => 4,
"type_id" => "simple",
"mediaGalleryEntries"=> [{
"mediaType"=> "image",
"label"=> "hassel",
"types" => ["base","small","thumbnail","swatch"],
"position"=> 0,
"disabled"=> false,
"file"=> "path/to/image.jpeg",
"content"=> {
"base64EncodedData"=> "base64_encoded_image",
"type"=> "image/jpeg",
"name"=> "image_name"
}
}]
}
Explore related questions
See similar questions with these tags.
default