我正在将Jet.com与我们基于Java的应用程序集成。我已成功上传Merchant Sku批量上传文件,但在合作伙伴仪表板中,它会显示错误“找不到文件”。
Java API代码:
try {
String url = fileURL.get("url").toString().trim();
String gzipFile = filePath + ".gz";
FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream(gzipFile);
GZIPOutputStream gzipOS = new GZIPOutputStream(fos);
byte[] buffer = new byte[1024];
int len;
while((len=fis.read(buffer)) != -1){
gzipOS.write(buffer, 0, len);
}
//close resources
gzipOS.close();
fos.close();
fis.close();
HttpPut request = new HttpPut(url);
request.addHeader("x-ms-blob-type", "blockblob");
FileEntity entity = new FileEntity(new File(gzipFile));
entity.setContentType(ContentType.APPLICATION_OCTET_STREAM.toString());
entity.setContentEncoding("gzip");
request.setEntity(entity);
HttpResponse res = httpClient.execute(request);
System.out.println(EntityUtils.toString(res.getEntity()));
return true;
}
在Jet.com合作伙伴门户网站中查看上传的文件时,会显示错误“找不到文件”。我想问题可能在于HttpPut文件上传代码,但我不确定。
答案 0 :(得分:0)
{"SL-SBEC-32L":{"product_title":"Foldable Fabric Drawer Lagoon Blue","product_description":"Brighten up your home with a lagoon blue Foldable Fabric Drawer from Tidy Living. The bright blue drawer offers a convenient way to organize and sort small items like cords, keys, cooking utensils and more. The cube-style drawers are perfect for use with cube organizers, open shelving units and more. The fabric drawers feature an open top for easy access and versatility. A built-in fabric handle on the front makes the drawer easy to grip and easy to operate. Foldable Fabric Drawers from Tidy Living are a great addition to any home’s decor and can even be used as a seasonal update. The medium cube organizers measure 10.5” W x 10.5” D x 11” H and are the perfect size for most uses. Other colors of fabric drawers are also available including black, red, and brown.","brand":"Tidy Living","standard_product_codes":[{"standard_product_code":"849392007293","standard_product_code_type":"UPC"}],"mfr_part_number":"SL-SBEC-32L","jet_browse_node_id":13000263,"multipack_quantity":1,"main_image_url":"https:\/\/tidyliving.com\/pub\/media\/catalog\/product\/s\/l\/sl-sbec-32l_-_non-woven_fabric_foldable_fabric_drawer_-_blue_-_angle.jpg","alternate_images":[{"image_slot_id":1,"image_url":"https:\/\/tidyliving.com\/pub\/media\/catalog\/product\/s\/l\/sl-sbec-32l_-_non-woven_fabric_foldable_fabric_drawer_-_blue_-_sideways.jpg"},{"image_slot_id":2,"image_url":"https:\/\/tidyliving.com\/pub\/media\/catalog\/product\/s\/l\/sl-sbec-32l_-_non-woven_fabric_foldable_fabric_drawer_-_blue_-_front.jpg"}]}}

这是json文件,文件需要采用.json.gz格式。
x-ms-blob-type :blockblob
。答案 1 :(得分:0)
我不确定您用于批量产品上传的api中的哪一个, 如果您正在使用
https://developer.jet.com/docs/testinput-1
然后你的网址应该是这样的:
https://prodimupload.blob.core.windows.net/merchant-files/ea74847dd3804e18a004233c4880e27b?sv=2015-04-05&sr=b&sig=6k2GN53DFdWSjFm%2BCA9nrA1i4nfGNVwmrYEzT%2FzVDPI%3D&se=2017-05-30T08%3A40%3A39Z&sp=w
你打电话给这个api时会得到:
/files/uploadToken