This topic describes how to use Image Search SDK for .NET 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 tasks that are used to export metadata.
BatchTask Creates a batch task.
BatchTaskList Queries 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.

  1. In Solution Explorer, right-click your project and select Manage NuGet Packages.
  2. On the page that appears, click the Browse tab and enter AlibabaCloud.SDK.ImageSearch20201214.
  3. Click Install.

Add

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Add
        {
            static void Main(string[] args)
            {
                // Console.WriteLine("Hello World!");
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXXXXXXXXXXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                FileStream fs = File.OpenRead("D:/111.jpg");
                AddImageAdvanceRequest request = new AddImageAdvanceRequest();
                // Required. The name of the image. The name cannot exceed 512 characters in length. 
                 // 1. Required. An image is uniquely identified by the product ID (ProductId) and image name (PicName). 
               // 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 = "xusong.jpg";
                // 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 = "1001";
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXXXXXXXXXXXXXXXX";
                // 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 and generic image searches, 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 = fs;
                // 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 = 99;
                 // 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 = "aliyun.com";
                // 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 = 5;
                // 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. 
                // The specified region cannot cross the boundary of the image. 
               // 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. 
               // 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 = "66,333,97,356";
                RuntimeOptions runtimeObject = new RuntimeOptions();
                try
                {
                    AddImageResponse response = client.AddImageAdvance(request, runtimeObject);
                    Console.WriteLine("result:" + Newtonsoft.Json.JsonConvert.SerializeObject(response))
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    result:{"Headers":{"date":"Mon, 11 Jan 2021 06:57:16 GMT","connection":"keep-alive","access-control-allow-origin":"*","access-control-allow-methods":"POST, GET, OPTIONS","access-control-allow-headers":"X-Requested-With, X-Sequence, _aop_secret, _aop_signature","access-control-max-age":"172800","x-acs-request-id":"6D32C931-D584-4927-938A-6053AE9B630D"},"Body":{"Message":"success","RequestId":"6D32C931-D584-4927-938A-6053AE9B630D","Code":0,"PicInfo":{"Region":"112,440,76,387","CategoryId":88888888},"Success":true}}

SearchImageByPic

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class SearchImageByPic
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                FileStream fs = File.OpenRead("D:/123.jpg");
                SearchImageByPicAdvanceRequest request = new SearchImageByPicAdvanceRequest();
                // 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 = 5;
                // 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 = fs;
                // 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 filter conditions.
               // 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 images based on IntAttr: int_attr>=100.
              // 2. Filter images based on StrAttr: str_attr!="value1".
              // 3. Filter images based on int_attr and str_attr : int_attr=1000 AND str_attr="value1".
                request.Filter = "int_attr=99";
                // 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 = "66,333,98,356";
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXX";
                RuntimeOptions runtimeObject = new RuntimeOptions();
                try
                {
                    SearchImageByPicResponse response = client.SearchImageByPicAdvance(request, runtimeObject);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response);
                    Console.WriteLine("result:" + result);
                    }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    result:
    {
        "RequestId":"632814A0-F34D-46FB-882D-81D74E7C3290",
        "Success":true,
        "Code":0,
        "Msg":"success",
        "Auctions":[
            {
                "CategoryId":0,
                "ProductId":"test",
                "PicName":"test.jpg",
                "CustomContent":null,
                "Score":1.0
                "SortExprValues":"7.33136443711219;0",
                "IntAttr":null,
                "StrAttr":null
            },
            {......}
            ],
        "Head":{
            "DocsReturn":4,
            "DocsFound":4,
            "SearchTime":155
        },
        "PicInfo":{
            "CategoryId":0,
            "Region":"202,596,155,637",
            "AllCategories":[{"Id":0,"Name":"Tops"},{.....}],
            "MultiRegion":[
                {"Region":"112,440,76,387"}
            ]
         }
    }

SearchImageByName

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class SearchImageByName
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                
                SearchImageByNameRequest request = new SearchImageByNameRequest();
                // 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 = 5;
                // Required. The name of the Image Search instance.
                request.InstanceName = "XXXXXXXXXX";
                // Required. The name of the image. The name cannot exceed 512 characters in length. 
                // 1. Required. An image is uniquely identified by the product ID (ProductId) and image name (PicName).
                request.PicName = "xusong.jpg";
                 // 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 = "1001";
                try
                {
                    SearchImageByNameResponse response = client.SearchImageByName(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    result:
    {
        "RequestId":"5B16E5CD-FE8A-4A4E-A90B-02A5C9F8BD81",
        "Success":true,
        "Code":0,
        "Msg":"success",
        "Auctions":[
            {
                "CategoryId":0,
                "ProductId":"test",
                "PicName":"test.jpg",
                "CustomContent":null,
                "Score":1.0
                "SortExprValues":"7.33136443711219;0",
                "IntAttr":null,
                "StrAttr":null
            },
            {....}
        ],
        "Head":{
            "DocsReturn":4,
            "DocsFound":4,
            "SearchTime":50
        },
        "PicInfo":{
            "CategoryId":0,
            "Region":null,
            "AllCategories":[
                {"Id":0,"Name":"Tops"},
                {...}
            ],
           "MultiRegion":[
                {"Region":"112,440,76,387"}
           ]
        }
    }

Delete

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Delete
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                DeleteImageRequest request = new DeleteImageRequest();
               // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                 // Required. The name of the image. The name cannot exceed 512 characters in length. 
                 // 1. Required. An image is uniquely identified by the product ID (ProductId) and image name (PicName). 
                request.PicName = "xusong.jpg";
                // Optional. The name of the image. 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 ProductId and PicName parameters. 
                request.ProductId = "1001";
                try
                {
                    DeleteImageResponse response = client.DeleteImage(request);
                    Console.WriteLine("RequestId:" + response.Body.RequestId);
                    Console.WriteLine("Message:" + response.Body.Message);
                    Console.WriteLine("Code:" + response.Body.Code);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    RequestId:D9BDEAE0-674C-4126-9D76-A79F0BE9E881
    Message:success
    Code:0

Update

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Update
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                UpdateImageRequest request = new UpdateImageRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                // Required. The ID of the product. The product ID cannot be changed. 
                request.ProductId = "1";
                // Required. The name of the image. The image name cannot be changed. 
                request.PicName = "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.IntAttr = 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.StrAttr = "test";
                // Optional. The description that you want to add. The description cannot exceed 4,096 characters in length. 
                request.CustomContent ="This is a sample description";
                try
                {
                    DeleteImageResponse response = client.UpdateImage(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    result:{"Code":0,"Message":null,"RequestId":"4F66A9C0-9D36-152A-B5DB-C0B3624D3331","Success":true}

Detail

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Detail
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                DetailRequest request = new DetailRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                try
                {
                    DetailResponse response = client.Detail(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • 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
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class DumpMeta
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                DumpMetaRequest request = new DumpMetaRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                try
                {
                    DumpMetaResponse response = client.DumpMeta(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    {
      RequestId=FC4191AA-1D5B-1001-9A70-18FBB2BD265B,
      Data={
        DumpMetaStatus=PROCESSING,
        Id=567
      },
      Success=true
    }

DumpMetaList

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class DumpMetaList
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                DumpMetaListRequest request = new DumpMetaListRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                // Optional. The ID of the task that is used to export metadata. 
                request.Id = 567;
                // Optional. The number of the page to return. Default value: 1. 
                request.PageNumber = 1;
                // Optional. The number of entries to return on each page. Default value: 20. 
                request.PageSize = 1;
                try
                {
                    DumpMetaListResponse response = client.DumpMetaList(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    {
      RequestId=850DFBD9-A179-12FB-B193-2D08ACEA586B,
      Data={
        TotalCount=1,
        PageSize=1,
        PageNumber=1,
        DumpMetaList=[
          {
            Status=SUCCESS,
            Msg=success,
            MetaUrl=https: //****.com/x?Expires=x,
            UtcCreate=1639969113000,
            UtcModified=1639969140000,
            Id=567,
            Code=0
          }
        ]
      }
    }

BatchTask

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class BatchTask
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                IncreaseInstanceRequest request = new IncreaseInstanceRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                // Required. If images are stored in an Object Storage Service (OSS) bucket, enter the bucket name. 
                request.BucketName = "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.Path = "/public/xx";
                // Optional. The callback address if the call succeeds. The address must start with the string http:// or https://. 
                request.CallbackAddress = "xxx";
                try
                {
                    IncreaseInstanceResponse response = client.IncreaseInstance(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • Sample responses
    {
      RequestId=F9BAD635-3031-1EBB-BE9E-E9FCB318A28C,
      Data={
        IncrementStatus=PROCESSING,
        Id=1470
      },
      Success=true
    }

BatchTaskList

  • Sample code
    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class BatchTaskList
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                config.AccessKeyId = "XXXXXXXXX";
                config.AccessKeySecret = "XXXXXXXXX";
                config.Endpoint = "imagesearch.cn-shanghai.aliyuncs.com";
                config.RegionId = "cn-shanghai";
                config.Type = "access_key";
                Client client = new Client(config);
                IncreaseListRequest request = new IncreaseListRequest();
                // Required. The name of the Image Search instance. 
                request.InstanceName = "XXXXXXXXXXX";
                // Optional. The ID of the task that is used to export metadata. 
                request.Id = 567;
                // Required. If images are stored in an OSS bucket, enter the bucket name. 
                request.BucketName = "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.Path = "/public/xx";
                // Optional. The number of the page to return. Default value: 1. 
                request.PageNumber = 1;
                // Optional. The number of entries to return on each page. Default value: 20. 
                request.PageSize = 1;
                try
                {
                    IncreaseListResponse response = client.IncreaseList(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("Returned InnerException:" + e.InnerException.Message);
                    Console.WriteLine("Returned data:" + e.Data);
                    Console.WriteLine("Returned message:" + e.Message);
                    Console.WriteLine("Returned string:" + e.ToString());
                }
            }
        }
    }
  • 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: //example.com/xxx?Expires=1670661540&xxx=xx,
              UtcModified=1639125540000,
              Id=1464,
              CallbackAddress=null,
              Code=0
            }
          ]
        }
      }
    }