Can I make UploadSiteHostedPictures API call directly via eBay Java SDK ?
Summary
The sample java program below is written with eBay JAVA SDK framework. The code illustrates how to upload multiple images from a local file system to the eBay picture server.
Java SDK uses UploadSiteHostedPictures, the only call in the Trading API that doesn't support SOAP, to upload image files in binary form. The source code for using UploadSiteHostedPictures functionality can be found in the Java SDK com.ebay.sdk.pictureservice package : ${java_sdk}/source/core/src/com/ebay/sdk/pictureservice.
//build a PictureInfo array for holding multiple picture file names PictureInfo[] piList = new PictureInfo[pictureFiles.length]; for(int i = 0; i < pictureFiles.length; i ++) { piList[i] = new PictureInfo(); piList[i].setPictureFilePath(pictureFiles[i]); }
int uploads = pictureService.uploadPictures (PhotoDisplayCodeType.NONE,piList);
if (uploads !=0 ) {
for(int i = 0; i < piList.length; i ++ ) {
String errorMsg= piList[i].getErrorMessage() ;
if (piList[i].getReponse().getAck().compareTo(AckCodeType.FAILURE)==0){
//http://developer.ebay.com/devzone/xml/docs/Reference/eBay/UploadSiteHostedPictures.html#Response.SiteHostedPictureDetails.FullURL // print out the generated image URL that can be used to associate with an item System.out.println (piList[i].getReponse().getSiteHostedPictureDetails().getFullURL());