Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Help Center/ Koo Command Line Interface/ FAQs/ Parameters/ How Do I Leave a Body Parameter Empty for Cloud Service APIs?

How Do I Leave a Body Parameter Empty for Cloud Service APIs?

Updated on 2023-10-16 GMT+08:00

KooCLI allows you to leave the body parameters of cloud service APIs empty at any level.

  • A map parameter can be left empty as {} at the corresponding level.
  • An array parameter can be left empty as [] at the corresponding level.
Take the BatchStopServers operation of ECS as an example. There are two parameters in the body: os-stop.servers.[N].id and os-stop.type.
hcloud ECS BatchStopServers --cli-region=ap-southeast-1 --help

KooCLI(Koo Command Line Interface) Version 3.2.8 Copyright(C) 2020-2023 www.huaweicloud.com

Service:
  ECS

Description:
This API is used to stop ECSs in a batch based on the specified ECS ID list. A maximum of 1000 ECSs can be stopped at a time.

Method:
  POST

Params:
  --cli-region
    required    string  Region where the API can be called. If no region is specified in the command, cli-region in the current profile is used.
  --os-stop.servers.[N].id
    required    string  body    ECS Instance ID. Format: --os-stop.servers.1.id=value1 ...
  --project_id
    required    string  path    Specifies the project ID. If no project ID is specified in the command, either the parent project ID of the specified region in the authentication information or cli-project-id in the current profile is used.
  --os-stop.type
    optional    string  body    Specifies an ECS stop type. The default value is SOFT. [SOFT|HARD]
    - SOFT: normal ECS stop (default)
    - HARD: forcible ECS stop
  • No parameters left empty
    Pass the values of os-stop.servers.[N].id and os-stop.type, and run --dryrun to view the request body:
    hcloud ECS BatchStopServers --cli-region=ap-southeast-1 --os-stop.servers.1.id="test" --os-stop.type="SOFT" --dryrun
    -------- The execution is eliminated in dry-run mode. Current request: --------
    POST https://ecs.ap-southeast-1.myhuaweicloud.com/v1/0a152ab****************262d035e8/cloudservers/action
    Content-Type: application/json;charset=UTF-8
    X-Project-Id: 0a152ab****************262d035e8
    X-Sdk-Date: 20221116T121721Z
    Authorization: ****
    
    {
      "os-stop": {
        "servers": [
          {
            "id": "test"
          }
        ],
        "type": "SOFT"
      }
    }
  • Array parameter left empty
    Pass --os-stop.servers="[]" for the array parameter os-stop.servers of os-stop.servers.[N].id to leave [N] and the remaining part empty. Then run --dryrun to view the request body:
    hcloud ECS BatchStopServers --cli-region=ap-southeast-1 --os-stop.servers="[]" --os-stop.type="SOFT" --dryrun
    -------- The execution is eliminated in dry-run mode. Current request: --------
    POST https://ecs.ap-southeast-1.myhuaweicloud.com/v1/0a152ab****************262d035e8/cloudservers/action
    X-Project-Id: 0a152ab****************262d035e8
    X-Sdk-Date: 20221116T122841Z
    Authorization: ****
    Content-Type: application/json;charset=UTF-8
    
    {
      "os-stop": {
        "servers": [],
        "type": "SOFT"
      }
    }
  • Map parameter left empty
    Pass --os-stop="{}" for the common parent os-stop of os-stop.servers.[N].id and os-stop.type to leave the map parameter empty. Then run --dryrun to view the request body:
    hcloud ECS BatchStopServers --cli-region=ap-southeast-1 --os-stop="{}" --dryrun
    -------- The execution is eliminated in dry-run mode. Current request: --------
    POST https://ecs.ap-southeast-1.myhuaweicloud.com/v1/0a152ab****************262d035e8/cloudservers/action
    Content-Type: application/json;charset=UTF-8
    X-Project-Id: 0a152ab****************262d035e8
    X-Sdk-Date: 20221117T013616Z
    Authorization: ****
    
    {
      "os-stop": {}
    }

KooCLI checks the parameter values during command execution. It displays an error message if an empty value does not match the parameter type. For example, if the empty value [] for an array parameter is assigned to the map parameter os-stop, the following error message is displayed:

[USE_ERROR] The value of map parameter os-stop is invalid.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback