All Products
Search
Document Center

Alibaba Cloud CLI:Forcibly call an API operation

Last Updated:Jul 25, 2024

Alibaba Cloud CLI checks the validity of parameters when you call the APIs of cloud services. Because the APIs are available in multiple versions, the built-in information about cloud services and API operations do not meet all requirements. You can forcibly call an API operation that is not in the metadata list and check the accuracy of specific information about the API operation.

Description of the --force option

In Alibaba Cloud CLI, if you call an API operation or specify a parameter that is not included in the metadata, the unknown api or unknown parameter error is reported. You can forcibly call API operations and use parameters that are not in the metadata by using the --force option. To do so, make sure that the following information is accurate:

Example

Scenario

In this example, the operations of CloudMonitor that are used to query the monitoring data of a metric are used. In the 2019-01-01 version of the CloudMonitor API, the operation is DescribeMetricList. However, in the 2017-03-01 version of the CloudMonitor API, the operation is QueryMetricList. If you directly call the QueryMetricList operation in Alibaba Cloud CLI, an error is reported.

image

Sample command

  1. Run the following command to forcibly call the QueryMetricList operation of the 2017-03-01 version:

    aliyun cms QueryMetricList --Project acs_ecs_dashboard --Metric cpu_idle --version 2017-03-01 --force
  2. The following figure provides an example of returned results.

    image