Queries the tags that are attached to one or more Server Migration Center (SMC) resources. SMC resources consist of migration sources and migration tasks.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagResources

The operation that you want to perform. Set the value to ListTagResources.

ResourceType String Yes sourceserver

The type of the SMC resource. Valid values:

  • sourceserver: migration source
  • replicationjob: migration task
NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query.

ResourceId.N String No s-bp1e2fsl57knvuug****

The ID of the SMC resource. SMC resources consist of migration sources and migration tasks.

Tag.N.Key String No TestKey

The key of tag N. The key must be 1 to 128 characters in length. Valid values of N: 1 to 20.

Tag.N is used for exact match of SMC resources to which the tag is attached. Tag N consists of a key-value pair.

  • Tag keys and values are case-sensitive.
  • If you set only the Tag.N.Key parameter, all resources to which the specified tags are attached are returned.
  • If you set only the Tag.N.Value parameter, the error message InvalidParameter.TagValue is returned.
  • If you specify multiple tag key-value pairs at a time, only SMC resources that match all tag key-value pairs are returned.
Tag.N.Value String No TestValue

The value of tag N. The value must be 1 to 128 characters in length. Valid values of N: 1 to 20.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query.

If a null value is returned for this parameter, no more tags can be queried.

RequestId String 17743161-66F3-4E7F-B8AE-845FB28B928F

The ID of the request.

TagResources Array of TagResource

The returned information about the SMC resources and tags. The information includes the ID, type, and tag key-value pairs of the resources.

TagResource
ResourceType String ALIYUN::SMC::SOURCESERVER

The type of the resource.

TagValue String TestValue

The tag value of the resource.

ResourceId String s-bp1e2fsl57knvuug****

The ID of the resource.

TagKey String TestKey

The tag key of the resource.

Examples

Sample request

http(s)://smc.aliyuncs.com/?Action=ListTagResources
&ResourceType=sourceserver
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTagResourcesResponse>
    <TagResources>
        <TagResource>
            <ResourceType>ALIYUN::SMC::SOURCESERVER</ResourceType>
            <TagValue>TestValue</TagValue>
            <ResourceId>s-bp1e2fsl57knvuug****</ResourceId>
            <TagKey>TestKey</TagKey>
        </TagResource>
        <TagResource>
            <ResourceType>ALIYUN::SMC::SOURCESERVER</ResourceType>
            <TagValue>TestValue</TagValue>
            <ResourceId>s-bp133rsym9xiek5k****</ResourceId>
            <TagKey>TestKey</TagKey>
        </TagResource>
    </TagResources>
    <NextToken/>
    <RequestId>17743161-66F3-4E7F-B8AE-845FB28B928F</RequestId>
</ListTagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TagResources" : {
    "TagResource" : [ {
      "ResourceType" : "ALIYUN::SMC::SOURCESERVER",
      "TagValue" : "TestValue",
      "ResourceId" : "s-bp1e2fsl57knvuug****",
      "TagKey" : "TestKey"
    }, {
      "ResourceType" : "ALIYUN::SMC::SOURCESERVER",
      "TagValue" : "TestValue",
      "ResourceId" : "s-bp133rsym9xiek5k****",
      "TagKey" : "TestKey"
    } ]
  },
  "NextToken" : "",
  "RequestId" : "17743161-66F3-4E7F-B8AE-845FB28B928F"
}

Error codes

HTTP status code Error code Error message Description
400 NumberExceed.Tags The maximum number of the Tag parameters cannot exceed 20. The error message returned because the number of specified tags exceeds the upper limit of 20.
400 MissingParameter.ResourceType You must specify ResourceType. The error message returned because the resource type is not specified.
400 InvalidResourceType.NotFound The specified ResourceType does not exist. The error message returned because the resource type does not exist.
400 NumberExceed.ResourceIds The maximum number of ResourceId parameters cannot exceed 50. The error message returned because the number of specified resource IDs exceeds the upper limit of 50.
400 Duplicate.ResourceId The ResourceId contains duplicate values. The error message returned because duplicate resource IDs are specified.
400 InvalidResourceId.NotFound The specified ResourceIds do not exist. The error message returned because the specified resource does not exist.

For a list of error codes, visit the API Error Center.