All Products
Search
Document Center

Alibaba Cloud CLI:Parameter formats

最終更新日:Jan 02, 2024

This topic describes the format requirements for parameters of different data types that you enter in Alibaba Cloud CLI.

For parameters of different data types in API operations, you must meet the following format requirements when you enter the parameter names and values in Alibaba Cloud CLI:

  • Case sensitivity of parameter names: Parameter names in API operations are case-sensitive. When you enter parameter names in Alibaba Cloud CLI, you must follow the capitalization conventions of parameter names.

  • Case sensitivity of parameter values: The values of some parameters in API operations are not case-sensitive. However, to ensure uniform writing, we recommend that you follow the capitalization conventions of parameter values when you enter parameter values.

  • Parameter values written as INTEGER type in API documentation: For parameter values of the INTEGER type, directly enter the values.

    Example:

    aliyun ecs DescribeImages --ImageName WindowsTest --Pagesize 10
  • Parameter values written as STRING type in API documentation: For STRING type values that contain no special characters, directly enter the values. For STRING type values that contain special characters, enclose the values in single quotation marks or double quotation marks when you enter the values. In Linux, macOS, or Windows PowerShell, use single quotation marks. In Windows Shell, use double quotation marks.

    Examples:

    • Without special characters:

      aliyun ecs DescribeImages --ImageName WindowsTest
    • With special characters:

      • Windows:

        aliyun ecs DescribeImages --ImageName "Custom image_1-10.11.161.1"
      • Linux or macOS:

        aliyun ecs DescribeImages --ImageName 'Blue screen on Windows-Database business-10.173.161.26'
  • Parameter values written as lists of the STRING type in API documentation: For STRING type parameters that support multiple values, such as ImageId, separate parameter values with commas and enclose the values in single quotation marks or double quotation marks when you enter the values.

    Examples:

    • Windows:

      aliyun ecs DescribeImages --ImageId "m-23e0oxmbv,m-23waejuy9"
    • Linux or macOS:

      aliyun ecs DescribeImages --ImageId 'm-23e0oxmbv,m-23waejuy9'
  • Parameter values written as JSON arrays of the STRING type in API documentation: For STRING type parameters that are set to a formatted JSON array, enclose the array in brackets and enclose the brackets in double quotation marks. Inside the brackets, separate values in the array with commas and enclose each value in single quotation marks. You can also enclose each value in double quotation marks and enclose the entire array with brackets in single quotation marks.

    Examples:

    • Windows:

      aliyun ecs DescribeDisks --DiskIds "['d-23rssg24f','d-23vsih26x','d-23sfqfbfa']"
    • Linux or macOS:

      aliyun ecs DescribeDisks --DiskIds '["d-23rssg24f","d-23vsih26x","d-23sfqfbfa"]'
  • Parameter values written as JSON array lists of the STRING type in API documentation: For STRING type parameters that are set to a JSON array list, enclose the list in brackets and enclose the brackets in double quotation marks. Inside the brackets, separate arrays with commas and enclose each array in braces. Inside each pair of braces, separate the key and value of an array with a colon and enclose the key and the value of the array in single quotation marks. You can also enclose the key and the value of an array in double quotation marks and enclose the entire list with brackets in single quotation marks.

    Examples:

    • Windows:

      aliyun slb AddBackendServers --LoadBalancerId 15157b19f18-cn-hangzhou-dg-a01 --BackendServers "[{'ServerId':'i-23g8aact0'},{'ServerId':'i-23bb03yh9'}]"
    • Linux or macOS:

      aliyun slb AddBackendServers --LoadBalancerId 15157b19f18-cn-hangzhou-dg-a01 --BackendServers '[{"ServerId":"i-23g8aact0"},{"ServerId":"i-23bb03yh9"}]'
  • Parameter values written as DateTime values of the STRING type in API documentation: For STRING type parameters that are set to a UTC timestamp in the ISO 8601 standard, enter the parameter values in the YYYY-MM-DDThh:mm:ssZ format.

    Example:

    aliyun ecs DescribeInstanceMonitorData --InstanceId i-94ola4btx --StartTime 2015-11-28T15:00:00Z --EndTime 2015-11-28T18:00:00Z

  • Special parameters

    If you enter a parameter value that contains special characters, a parsing error may occur. To resolve this issue, enter the parameter value in the key=value format. For example, replace --PortRange -1/-1 with --PortRange=-1/-1 to ensure successful code execution.