dangdang.item.imgspace.uploadImg(图片空间)

上传图片到图片空间

  • 上传图片到图片空间

    支持的数据格式:XML

    HTTP请求方式:POST

    版本:1.0

  • 系统级输入参数:

    请参考系统级输入参数

    应用级输入参数:

    参数名称
    参数类型
    是否必填
    示例值
    参数说明
    shopId Number 489 店铺ID
    imgFile File
    图片文件,只能是jpg、png、gif三种格式图片
    columnId Number 12 图片分类id,默认为0(所有图片
    imgName String 商品主图 图片名称(支持汉字,50个字符之内)
  • XML数据格式:

    01 <?xml version="1.0" encoding="gbk"?>
    02 <response>
    03     <result>true</result>
    04     <resultCode>200</resultCode>
    05     <resultMessage>请求成功</resultMessage>
    06     <functionID>uploadImg</functionID>
    07     <time>2013-09-12 21:26:46</time>
    08     <imgInfo>
    09         <id>20822</id>
    10 <shopId>489</shopId>
    11         <columnId>1</columnId>
    12         <imgName>图片2</imgName>
    13         <imgUrl>http://img57.ddimg.cn/4890000020827.jpg</imgUrl>
    14         <imgUrl_y>http://img57.ddimg.cn/4890000020827_y.jpg</imgUrl_y>
    15         <imgUrl_s>http://img57.ddimg.cn/4890000020827_s.jpg</imgUrl_s>
    16         <imgSize>10087</imgSize>
    17         <imgMeasure>500*500</imgMeasure>
    18     </imgInfo>
    19 </response>

    JSON数据格式:

    1  

  • java版

    SdkClient sdk= new SdkClient(appKey, appSecret, session, version) ;
    ImgSpaceUploadImgRequest request=new ImgSpaceUploadImgRequest();
    ImgSpaceUploadImg imgSpaceUploadImg = new ImgSpaceUploadImg();
    imgSpaceUploadImg.setColumnId(0L);
    request.setImgFileFile(new FileItem(new File(path)));
    request.setImgSpaceUploadImg(imgSpaceUploadImg);
    ImgSpaceUploadImgResponse response=sdk.excute(request);
    System.out.println( response.toString());


    php版

    $sdkClient = new DDHttpClient(appkey,appSecret,session);
    $ItemImgspaceUploadImgRequest = new ItemImgspaceUploadImgRequest();
    $ItemImgspaceUploadImgRequest->setImgFile($xmlFile);
    $sdkResponse = $sdkClient->execute($ItemImgspaceUploadImgRequest);