This topic describes how to use Image Search SDK for Java and provides sample code.

Methods

Method Description
Add Adds one or more images.
SearchImageByPic Searches for similar images based on an image.
SearchImageByName Searches for similar images based on the name of an existing image in the image gallery.
Delete Deletes one or more images.
Update Updates image information.
Detail Queries instance information.
DumpMeta Creates a task to export metadata.
DumpMetaList Queries the tasks that are used to export metadata.
BatchTask Creates a batch task.
BatchTaskList Queries the tasks that are used to perform batch operations.

Preparations

  • Before you install and use an Alibaba Cloud SDK, make sure that you have created an Alibaba Cloud account and obtained the AccessKey pair of the Alibaba Cloud account. For more information, see Obtain an AccessKey pair.
  • Add OpenSearch SDK for Java to your project
    Import Image Search SDK for Java as a Maven dependency, and add the SDK to your project.
      <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>imagesearch20201214</artifactId>
            <version>4.0.0</version>
       </dependency>

Add

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.imagesearch20201214.models.AddImageAdvanceRequest;
    import com.aliyun.imagesearch20201214.models.AddImageResponse;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    public class Add {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            AddImageAdvanceRequest request = new AddImageAdvanceRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXXXX";
             // Required. The ID of the product. The ID cannot exceed 512 characters in length. 
             // A product ID can correspond to multiple image names. 
            request.productId = "test";
            // Required. The name of the image. The name cannot exceed 512 characters in length. 
           // 1. Required. An image is uniquely identified by the values of the ProductId and PicName parameters. 
           // 2. If you add an image whose product ID (ProductId) and image name (PicName) are the same as those of an existing image, the newly added image overwrites the existing image. 
            request.picName = "1000";
            // Optional. The ID of the product category. 
            // 1. For product search: If a category is specified, the specified category prevails. If no category is specified, the system estimates and selects a category. The category selected by the system is included in the response. 
            // 2. For generic search: The parameter value is set to 88888888 regardless of whether a category is specified. 
            request.categoryId = 3;
             // Optional. The user-defined content. The value can be up to 4,096 characters in length. 
            // If you set this parameter, the response includes this parameter and its value. You can add text such as an image description. 
            request.customContent = "this is a simple test";
             // Optional. The attribute of the INT type. The attribute can be used to filter images in image searches. If you set this parameter, the response includes this parameter and its value. 
            // For example, you can set different attributes for images from different sites or different users. This way, users can filter images by attribute and obtain more accurate search results.
            request.intAttr = 56;
            // Optional. The attribute of the STRING type. The value cannot exceed 128 characters in length. The attribute can be used to filter images in image searches. If you set this parameter, the response includes this parameter and its value. 
            request.strAttr = "test";
            // Optional. Specifies whether to recognize the subject in the image. Default value: true. 
            // 1. If you set this parameter to true, the system recognizes the subject in the image, and searches for images based on the recognized subject. The response includes the recognition result. 
            // 2. If you set this parameter to false, the system searches for images based on the entire image without subject recognition. 
            request.crop = true;
            // Optional. The subject area of the image, in the format of x1,x2,y1,y2. Specifically, x1 and y1 specify the upper-left pixel, and x2 and y2 specify the lower-right pixel. The specified region cannot cross the boundary of the image. 
           // If you set the Region parameter, the search is conducted based on the value of the Region parameter regardless of the value of the Crop parameter. 
            request.region = "167,467,221,407";
            RuntimeOptions runtimeOptions = new RuntimeOptions();
            String picName = "D:/123.jpg";
            InputStream inputStream = new FileInputStream(picName);
            // The image. The image cannot exceed 4 MB in size. The transmission timeout period is 5 seconds. Only the following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WebP, TIFF, and PPM.
            // For product, brand, and generic images, the length and the width of the image must range from 100 pixels to 4,096 pixels.
            // For cloth images, the length and the width of the image must range from 448 pixels to 4,096 pixels.
            // The image cannot contain rotation properties.
            request.picContentObject = inputStream;
            try {
                AddImageResponse response = client.addImageAdvance(request,runtimeOptions);
               System.out.println("success: " + response.getBody().success + ". message: " 
                    + response.getBody().message        
                    + ". categoryId: " + response.getBody().picInfo.categoryId 
                    + ". region:" + response.getBody().picInfo.region        
                    + ". requestId: " + response.getBody().requestId);
            } catch (TeaException e) {
                System.out.println(e.getCode());
                System.out.println(e.getData());
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
    }
  • Sample responses
    success: true. message: success. categoryId: 9. region:383,681,291,549. requestId: 016D63E3-D0C5-42D3-8879-55E1A705FBA4

SearchImageByPic

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.SearchImageByPicAdvanceRequest;
    import com.aliyun.imagesearch20201214.models.SearchImageByPicResponse;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class SearchImageByPic {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            SearchImageByPicAdvanceRequest request = new SearchImageByPicAdvanceRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            // Optional. The ID of the product category. 
            // 1. For product search: If a category is specified, the specified category prevails. If no category is specified, the system estimates and selects a category. The category selected by the system is included in the response. 
            // 2. For generic search: The parameter value is set to 88888888 regardless of whether a category is specified. 
            request.categoryId = 3;
            // Optional. The number of entries to be returned. Valid values: 1 to 100. Default value: 10. 
            request.num = 10;
             // Optional. The ordinal number of the first entry that is returned. Valid values: 0 to 499. Default value: 0. 
            request.start = 0;
              // Optional. Specifies whether to recognize the subject in the image. Default value: true. 
            // 1. If you set this parameter to true, the system recognizes the subject in the image, and searches for images based on the recognized subject. The response includes the recognition result. 
            // 2. If you set this parameter to false, the system searches for images based on the entire image without subject recognition. 
            request.crop = true;
              // Optional. The subject area of the image, in the format of x1,x2,y1,y2. Specifically, x1 and y1 specify the upper-left pixel, and x2 and y2 specify the lower-right pixel. The specified region cannot cross the boundary of the image. 
            // If you set the Region parameter, the search is conducted based on the value of the Region parameter regardless of the value of the Crop parameter. 
            request.region="167,467,221,407";
            // Optional. The filter condition.
            // int_attr supports the following operators: >, >=, <, <=, and =. str_attr supports the = and != operators. You can set the logical operator between conditions to AND or OR. 
            // Examples:
            // 1. Filter results based on IntAttr: int_attr>=100.
            // 2. Filter results based on StrAttr: str_attr!="value1".
            // 3. Filter images based on int_attr and str_attr fields: int_attr=1000 AND str_attr="value1".
            request.filter="int_attr=56 AND str_attr=\"test\"";
            InputStream inputStream = new FileInputStream("D:/123.jpg");
             // The image. The image cannot exceed 4 MB in size. The transmission timeout period is 5 seconds. Only the following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WebP, TIFF, and PPM.
            // For product, brand, and generic images, the length and the width of the image must range from 100 pixels to 4,096 pixels.
            // For cloth images, the length and the width of the image must range from 448 pixels to 4,096 pixels.
            // The image cannot contain rotation properties.
            request.picContentObject = inputStream;
            request.num = 10;
            request.start = 0;
            RuntimeOptions runtimeObject =  new RuntimeOptions();
            try {
                SearchImageByPicResponse response = client.searchImageByPicAdvance(request, runtimeObject);
                System.out.println(response.getBody().requestId);
                System.out.println(response.getBody().picInfo.categoryId);
                System.out.println(response.getBody().picInfo.region);
                List<SearchImageByPicResponseBody.SearchImageByPicResponseBodyAuctions> auctions = response.getBody().getAuctions();
                for(SearchImageByPicResponseBody.SearchImageByPicResponseBodyAuctions auction:auctions) {    
                    System.out.println(auction.categoryId + " " + auction.picName + " " 
                        + auction.productId + " " + auction.customContent + " " + auction.score + " " 
                        + auction.strAttr + " " + auction.intAttr);
                }
                System.out.println("Multi-subject information");
                SearchImageByPicResponseBody.SearchImageByPicResponseBodyPicInfo picInfo = response.getBody().getPicInfo();
                for (SearchImageByPicResponseBody.SearchImageByPicResponseBodyPicInfoMultiRegion multiRegion : picInfo.getMultiRegion()) {    
                    System.out.println(multiRegion.region);
                }
            } catch (TeaException e) {
                System.out.println(e.getCode());
                System.out.println(e.getData());
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
    }
  • Sample responses
    09BE019A-AE3D-4D22-99C9-10533D8AC631
    3
    167,467,221,407
    3 1000 test this is a simple test 1.0 test 56
    Multi-subject information
    112,440,76,387

SearchImageByName

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.SearchImageByNameRequest;
    import com.aliyun.imagesearch20201214.models.SearchImageByNameResponse;
    import com.aliyun.tea.TeaException;
    import java.util.List;
    public class  SearchImageByName{
        public static void main(String[] args) throws Exception {
            // The configurations.
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            SearchImageByNameRequest request = new SearchImageByNameRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
             // Required. The ID of the product. The ID cannot exceed 512 characters in length. 
            // A product ID can correspond to multiple image names. 
            request.productId = "test";
             // Required. The name of the image. The name cannot exceed 512 characters in length. 
            // 1. Required. An image is uniquely identified by the values of the ProductId and PicName parameters. 
            request.picName = "1000";
             // Optional. The ID of the product category. 
            // 1. For product search: If a category is specified, the specified category prevails. If no category is specified, the system estimates and selects a category. The category selected by the system is included in the response. 
            // 2. For generic search: The parameter value is set to 88888888 regardless of whether a category is specified. 
            request.categoryId = 3;
            // Optional. The number of entries to be returned. Valid values: 1 to 100. Default value: 10. 
            request.num =10;
             // Optional. The ordinal number of the first entry that is returned. Valid values: 0 to 499. Default value: 0. 
            request.start =0;
            // Optional. The filter condition.
            // int_attr supports the following operators: >, >=, <, <=, and =. str_attr supports the = and != operators. You can set the logical operator between conditions to AND or OR. 
            // Examples:
            // 1. Filter results based on IntAttr: int_attr>=100.
            // 2. Filter results based on StrAttr: str_attr!="value1".
            // 3. Filter images based on int_attr and str_attr fields: int_attr=1000 AND str_attr="value1".
            request.filter = "int_attr=56 AND str_attr =\"test\"";
            try {
                SearchImageByNameResponse response = client.searchImageByName(request);
                System.out.println(response.getBody().requestId);
                System.out.println(response.getBody().picInfo.categoryId);
                System.out.println(response.getBody().picInfo.region);
                List<SearchImageByNameResponseBody.SearchImageByNameResponseBodyAuctions> auctions = response.getBody().getAuctions();
                for(SearchImageByNameResponseBody.SearchImageByNameResponseBodyAuctions auction:auctions) {    
                    System.out.println(auction.categoryId + " " + auction.picName + " " 
                        + auction.productId + " " + auction.customContent + " " + auction.score + " " 
                        + auction.strAttr + " " + auction.intAttr);
                }
            } catch (TeaException e) {
                System.out.println(e.getCode());
                System.out.println(e.getData());
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
    }
  • Sample responses
    8F2441C8-EA05-461B-A4AC-5F5DE25FAC21
    3
    null
    3 1000 test this is a simple test 1.0 test 56
                        

Delete

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.DeleteImageRequest;
    import com.aliyun.imagesearch20201214.models.DeleteImageResponse;
    import com.aliyun.tea.TeaException;
    public class Delete {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            DeleteImageRequest request = new DeleteImageRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXXXXX";
            // Required. The ID of the product. The ID cannot exceed 512 characters in length. 
            // A product ID can correspond to multiple image names. If you set only this parameter and not the picName parameter, the response includes all the names of the images that are deleted.
            request.productId = "test";
             // Optional. The image name. If you do not set this parameter, the system deletes all the images that correspond to the specified product ID. If you set this parameter, the system deletes only the image that is specified by the product_id and pic_name parameters. 
            request.picName = "1000";
            try {
                DeleteImageResponse response = client.deleteImage(request);
                System.out.println(response.getBody().toMap());
            } catch (TeaException e) {
                System.out.println(e.getCode());
                System.out.println(e.getData());
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
    }
  • Sample responses
    {
      Message=success,
      RequestId=994A7095-09AA-127A-873B-A2279261605F,
      Data={
        PicNames=[
          82.png
        ]
      },
      Code=0,
      Success=true
    }

UpdateImage

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class UpdateImage {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            UpdateImageRequest request = new UpdateImageRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            // Required. The ID of the product. The product ID cannot be changed. 
            request.setProductId("1");
            // Required. The name of the image. The image name cannot be changed. 
            request.setPicName("1");
            // Optional. The attribute of the INT type. The attribute can be used to filter images in image searches. If you set this parameter, the response includes this parameter and its value. 
            request.setIntAttr(1);
            // Optional. The attribute of the STRING type. The value cannot exceed 128 characters in length. The attribute can be used to filter images in image searches. If you set this parameter, the response includes this parameter and its value. 
            request.setStrAttr("test");
            // Optional. The description that you want to add. The value cannot exceed 4,096 characters in length. 
            request.setCustomContent("This is a sample description");
            UpdateImageResponse updateImageResponse = client.updateImage(request);
            System.out.println("requestId: " + response.getBody().requestId + ". success: " + response.getBody().success + ". message: " + response.getBody().message);     
        }
    }
  • Sample responses
    requestId: AB8AA177-89AB-14D5-BEE0-293C32D5C43A. success: true. message: null

Detail

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class Detail {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            DetailRequest request = new DetailRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            DetailResponse detail = client.detail(request);
            System.out.println(detail.getBody().toMap());  
        }
    }
  • Sample responses
    {
      RequestId=046913C5-942A-1DD2-959F-7CECD790ADB2,
      Instance={
        UtcExpireTime=1649692800000,
        TotalCount=225320,
        UtcCreate=1633936585000,
        Capacity=250,
        Qps=5,
        ServiceType=0,
        Region=cn-shanghai,
        Name=xxxx
      },
      Success=true
    }

DumpMeta

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class DumpMeta {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            DumpMetaRequest request = new DumpMetaRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            DumpMetaResponse response = client.dumpMeta(request);
            System.out.println(response.getBody().toMap());  
        }
    }
  • Sample responses
    {
      RequestId=FC4191AA-1D5B-1001-9A70-18FBB2BD265B,
      Data={
        DumpMetaStatus=PROCESSING,
        Id=567
      },
      Success=true
    }
                        

DumpMetaList

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class DumpMetaList {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            DumpMetaListRequest request = new DumpMetaListRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            // Optional. The ID of the task that is used to export metadata.
            request.setId(567L);
            // Optional. The number of the page to return. Default value: 1.
            request.setPageNumber(1);
            // Optional. The number of entries to return on each page. Default value: 20.
            request.setPageSize(1);
            DumpMetaListResponse response = client.dumpMetaList(request);
            System.out.println(response.getBody().toMap()); 
        }
    }
  • Sample responses
    {
      RequestId=850DFBD9-A179-12FB-B193-2D08ACEA586B,
      Data={
        TotalCount=1,
        PageSize=1,
        PageNumber=1,
        DumpMetaList=[
          {
            Status=SUCCESS,
            Msg=success,
            MetaUrl=https: //xxxx.com/x?Expires=x,
            UtcCreate=1639969113000,
            UtcModified=1639969140000,
            Id=567,
            Code=0
          }
        ]
      }
    }

BatchTask

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class BatchTask {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            IncreaseInstanceRequest request = new IncreaseInstanceRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            // Required. If images are stored in an Object Storage Service (OSS) bucket, enter the bucket name.
            request.setBucketName("bucketName");
            // Required. The path to the service where the images are stored. The path must start with a forward slash (/) and cannot end with a forward slash (/).
            request.setPath("/public/xxx");
            // Optional. The callback address if the call succeeds. The address must start with the string http:// or https://.
            request.setCallbackAddress("http://xxx/xxx");
            IncreaseInstanceResponse response = client.increaseInstance(request);
            System.out.println(response.getBody().toMap()); 
        }
    }
  • Sample responses
    {
      RequestId=F9BAD635-3031-1EBB-BE9E-E9FCB318A28C,
      Data={
        IncrementStatus=PROCESSING,
        Id=1470
      },
      Success=true
    }
                        

BatchTaskList

  • Sample code
    import com.aliyun.imagesearch20201214.Client;
    import com.aliyun.teaopenapi.models.Config;
    import com.aliyun.imagesearch20201214.models.*;
    import com.aliyun.tea.TeaException;
    import com.aliyun.teautil.models.RuntimeOptions;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.List;
    public class BatchTaskList {
        public static void main(String[] args) throws Exception {
            Config authConfig = new Config();
            authConfig.accessKeyId = "XXXXXXXX";
            authConfig.accessKeySecret = "XXXXXXXXXX";
            authConfig.type = "access_key";
            authConfig.endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
            authConfig.regionId = "cn-shanghai";
            Client client = new Client(authConfig);
            IncreaseListRequest request = new IncreaseListRequest();
            // Required. The name of the Image Search instance. 
            request.instanceName = "XXXXXXXXX";
            // Optional. The ID of the batch task.
            request.setId(1470L);
            // Optional. Query the name of the OSS bucket.
            request.setBucketName("BucketName");
            // Optional. Query the path to the OSS bucket.
            request.setPath("/localization/xxxx");
            // Optional. The ordinal number of the first entry that is returned. Default value: 1.
            request.setPageNumber(1);
            // Optional. The number of entries to be returned. Default value: 20.
            request.setPageSize(1);
            IncreaseListResponse response = client.increaseList(request);
            System.out.println(response.getBody().toMap()); 
        }
    }
  • Sample responses
    {
      RequestId=56E7E6CC-64AB-17CA-A7CD-1948FB953B8C,
      Data={
        TotalCount=1,
        PageSize=1,
        PageNumber=1,
        Increments={
          Instance=[
            {
              Msg=success,
              Status=NORMAL,
              Path=/xx/xx,
              BucketName=bucketName,
              UtcCreate=1639107872000,
              ErrorUrl=https: //ooooo.com/xxx?Expires=1670661540&xxx=xx,
              UtcModified=1639125540000,
              Id=1464,
              CallbackAddress=null,
              Code=0
            }
          ]
        }
      }
    }