5

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
asked Aug 26, 2015 at 15:46
1
  • Have you tried setting its position to 0? Commented Sep 7, 2015 at 13:44

1 Answer 1

0

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"
 }
 }]
 }
answered Feb 5, 2018 at 14:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.