This topic describes the format requirements of different data types in API documentation for the commands entered into the Alibaba Cloud CLI.
For the fields of different data types in API documentation, commands in Alibaba Cloud CLI must follow the following format requirements:
Parameter case: Because API parameters are case sensitive, the parameters entered in Alibaba Cloud CLI must also be case sensitive.
Parameter value case: Some parameter values are not case sensitive. However, we recommend that you make all parameter values case sensitive so to maintain a uniform style.
Entering String-type parameter values: For parameters marked as String in API documentation, the parameter can be entered directly if it does not contain any special characters. Otherwise, you need to place these strings in single or double quotes when you enter them. In Linux, macOS, or Windows PowerShell, use single quotes (' '), and in Windows Shell, use double quotes (" ").
For example:
Without special characters:
aliyun ecs DescribeImages --ImageName WindowsTest
With special characters:
Windows:
aliyun ecs DescribeImages --ImageName "CustomImage_1-10.11.161.1"
Linux and macOS:
aliyun ecs DescribeImages --ImageName 'Blue_screen windows-DB-business-10.173.161.26'
Entering Integer-type parameter values: Parameters marked as Integer in API documentation can be entered directly.
For example:
aliyun ecs DescribeImages --ImageName WindowsTest --Pagesize 10
Entering String-type string list values: For parameters marked as String in API documentation, if a list of multiple values is supported (such as ImageId list), separate each value by using a comma(,). Next, for each value, enclose the value with single quotes(' ') or double quotes(" ").
For example:
Windows:
aliyun ecs DescribeImages --ImageId "m-23e0oxmbv,m-23waejuy9"
Linux and macOS:
aliyun ecs DescribeImages --ImageId 'm-23e0oxmbv,m-23waejuy9'
Entering String-type JSON array parameter values: For parameters marked as String in API documentation, if the parameter value must be formatted as a Json Array, enclose each value in single quotes (' '), then square brackets ([ ]), and last double quotes (" "). Separate each value by using a comma (,). Single and double quotes in the above usage can also be interchanged.
For example:
Windows:
aliyun ecs DescribeDisks --DiskIds "['d-23rssg24f','d-23vsih26x','d-23sfqfbfa']"
Linux and macOS:
aliyun ecs DescribeDisks --DiskIds '["d-23rssg24f","d-23vsih26x","d-23sfqfbfa"]'
Entering String-type JSON array list parameter values: For parameters marked as String in API documentation, if the parameter value must be a Json Array List, enclose each value in single quotes (' '), then square brackets ([ ]), and last double quotes (" "). Separate each value by using a comma (,). Separate keys and values in JSON Array by using colons (: :). Single and double quotes in the above usage can also be interchanged.
For example:
Windows:
aliyun slb AddBackendServers --LoadBalancerId 15157b19f18-cn-hangzhou-dg-a01 --BackendServers "[{'ServerId':'i-23g8aact0'},{'ServerId':'i-23bb03yh9'}]"
Linux and macOS:
aliyun slb AddBackendServers --LoadBalancerId 15157b19f18-cn-hangzhou-dg-a01 --BackendServers '[{"ServerId":"i-23g8aact0"},{"ServerId":"i-23bb03yh9"}]'
Entering String-type date format parameter value: For parameters marked as String in API documentation, if parameter value must be a UTC time expressed according to ISO 8601, enter the time in the following format: YYYY-MM-DDThh:mm;ssZ.
For example:
aliyun ecs DescribeInstanceMonitorData --InstanceId i-94ola4btx --StartTime 2015-11-28T15:00:00Z --EndTime 2015-11-28T18:00:00Z