- Function Overview
- What's New
- Service Overview
- Getting Started
-
User Guide
- Configuration Management
- HTTP Proxy
- Commonly Used Commands
-
Options
- Option Overview
- Printing Help Information
- Printing Debugging Information
- Generating API Input Parameter Skeleton in JSON Format
- Checking Command
- Specifying Region
- Calling APIs with AK/SK in Non-configuration Mode
- Specifying Account ID
- Specifying Profile
- Specifying Authentication Mode
- Specifying Output Format
- Passing API Parameters with JSON File
- Specifying Request Timeouts
- Specifying Retry Count
- Skipping HTTPS Request Certificate Verification
- Specifying a Domain Name
- Polling Results
- Obtaining CLI Examples on API Explorer
- Using KooCLI in Non-configuration Mode
- Online Experience
- Obtaining Authentication Information
-
FAQs
- Overview
- Authentication
- Profiles
- Metadata Cache
- Logs
- Network Connections
- Cloud Services
- Cloud Service APIs
- Regions
-
Parameters
- What Are KooCLI System Parameters?
- Why Am I Seeing a Message Indicating an Invalid Parameter?
- Why Are Old and New KooCLI System Parameters (Such as region and cli-region) Available? Which Parameters Are Recommended?
- Why Am I Seeing a Message Indicating a Duplicate Parameter?
- How Do I Use cli-jsonInput?
- When Can I Use cli-jsonInput?
- Why Am I Seeing a Message Indicating an Unsupported Parameter Position or Type?
- How Do I Leave a Body Parameter Empty for Cloud Service APIs?
- Interactive Mode and Autocomplete
-
Output Formats
- What Output Formats Are Supported by KooCLI?
- How Do I Define a JMESPath Expression?
- Which KooCLI System Parameters Are Related to Data Output? Which Ones Are Recommended?
- How Do I Use cli-output, cli-query, and cli-output-num?
- How Do I Use cli-output-rows, cli-output-cols, and cli-output-num? What Are the Precautions?
- How Do I Use cli-json-filter? What Are the Precautions?
- Other
- Videos
- General Reference
Copied.
How Do I Specify a Cloud Service API and Its Version?
Background
During a cloud service API call, KooCLI verifies the validity of your input parameters. If the service has multiple versions, some or all APIs of the service also have multiple versions. The parameters and application scenarios of an API may vary with versions. The CLI needs to obtain the version information of an API that belongs to a service with multiple versions.
Querying and Specifying the Version of a Cloud Service API
- Querying version information
Run hcloud <service> --help to view the operation list of the cloud service. If an operation appears multiple times in the Available Operations list and different version numbers are concatenated with a slash (/), specify a version when calling the API. For details, see Specifying a version. For other operations that appear only once in the operation list, their version numbers do not need to be concatenated. KooCLI calls their only version.
- Specifying a version
- Manually specifying a version
When calling an API that belongs to a service with multiple versions, use a slash (/) to manually add the version number after operation of the original API. For example, if operation is showLogs in the original command and showLogs/v1 and showLogs/v2 exist in the Available Operations list, you can set operation to showLogs/v1 or showLogs/v2.
- Using the default version
When calling an API that belongs to a service with multiple versions, if you do not specify a version in the command, KooCLI obtains all available versions of the API and sorts them in alphabetical order. The last version of the API in the list is called by default. (Generally, this version is the latest version of the API.)
- Manually specifying a version
Extended Question and Solution
- Question
When you call an API that belongs to a service with multiple versions by using the API's default version, if the metadata files cached locally are modified, KooCLI may not be able to correctly parse the API version based on the cache files. In this case, the following error message is displayed:
[USE_ERROR] The API has multiple versions. Specify one.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot