0

我將Jet.com與基於Java的應用程序集成在一起。我成功地上傳了Merchant Sku批量上傳文件,但在合作伙伴儀表板中出現錯誤「未找到文件」。Jet.Com批量上傳錯誤

的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文件上傳代碼有關,但我不確定。

enter image description here

+0

請不要dd請求緊急/儘快等你的問題,[閱讀更多](http://meta.stackoverflow.com/q/326569)。謝謝。 – halfer

+0

jet.com發回的HTTP返回碼是什麼? –

+0

返回代碼是200 OK,如果您檢查文件上傳到Jet.com服務器,但它發出文件未找到錯誤 – Jayesh

回答

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格式。

  1. 請檢查json.gz格式是否正確。
  2. 之後,將其上傳到您從「獲取網址請求
  3. 」中獲得的網址,如果需要,增加到期時間(以秒爲單位)。
  4. 檢查json.gz是否包含正確的merchantsku json文件。 5.檢查放入請求標頭是否包含x-ms-blob-type :blockblob
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