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


  • Have you tried setting its position to 0? – rlecaro2 Sep 7 '15 at 13:44

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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.