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,

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"
        }
    }]
    }

Your Answer

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.