Код: Выделить всё
[{
"id": "26",
"label": "",
"position": "1",
"exclude": "0",
"url": "http:\/\/localhost\/magento\/media\/catalog\/product\/6\/1\/61UROlGlryL._UL1500_.jpg_20.jpg",
"types": []
}]
Код: Выделить всё
Map < String, String > productimages = new HashMap < String, String > ();
productimages.put("file_mime_type", mime);
productimages.put("file_content", encodedImage);
productimages.put("file_name", pictureName);
String[] datas = {
"image", "small_image", "thumbnail"
};
productimages.put("types", datas.toString());
Gson gson = new Gson();
String productimages_json = gson.toJson(productimages);
StringEntity productimages_entity = new StringEntity(productimages_json, HTTP.UTF_8);
HttpPost httppost_img = new HttpPost(URL_PRODUCTS + "/6/images");
httppost_img.setHeader("Content-Type", "application/json");
httppost_img.setHeader("Accept", "application/json");
httppost_img.setEntity(productimages_entity);
Log.d("inserted", "");
HttpResponse response_img = client.execute(targetHost, httppost_img, localContext);
Код: Выделить всё
Map productimages = new HashMap();
String[] datas = {"image","small_image","thumbnail"};
productimages.put("types", datas);
Подробнее здесь: https://stackoverflow.com/questions/253 ... ap-to-rest
Мобильная версия