cancel
Showing results for 
Search instead for 
Did you mean: 

API upload images

API upload images

Hello,

 

I made my first steps with API REST. So far all is good working.

But some questions about product:

  1. Is it possible to upload a product and Magento with "add/update" it? 
    I upload to "rest/V1/products/SKU" .. so if the SKU exists he should update and if not he should add it. Is this correct?
    Because there is a POST to "rest/V1/products" and a PUT to "rest/V1/products/{SKU}" .. what are the difference?

 

But with the images I´m not sure how to handle:

I upload a product with embedded image to "rest/V1/products/SKU"

  1. Wenn I upload a 3000x3000px image with 1MB and set it to "thumbnail" .. resize Magento the image? When not and I display 10 products, the client has to load 10MB of images? Or did I have before I upöload to resize it?
  2. When I generate a image, I set the "MediaGalleryEntry" with:
    private int id;
    private String media_type;
    private String label;
    private int position;
    private boolean disabled;
    private List<String> types;
    private String file;
    private Content content;
    private ExtensionAttributes extension_attributes;

    Which one is for the "Alt Text" ... I want to set the ALT text but anytime this field is empty in Magento after uploading a image
  3. When I try to upload a bigger size of image (> 2MB) .. it takes sooooo long for the http POST. Is this because of Magento or my Java library which made the post?
  4. When I create a product, I get the response of the product ... crazy, because I get the image BASE64 image back ... when I upload a image with 2MB I also download after a JSON with 2MB ... is this correct?

When I upload first the product data and after only the images ... is this possible?
I did not found any methode for this in https://devdocs.magento.com/swagger/index.html#/

 

Thank you!