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
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

Constructing Requests

Updated on 2024-07-05 GMT+08:00

This section describes the structure of a RESTful API request, and uses the API for creating customers of HUAWEI CLOUD partners as an example to describe how to call an API.

Request URI

A request URI consists of the following:

{URI-scheme}://{Endpoint}/{resource-path}?{query-string}

Although the request URI is included in the request header, most languages or frameworks require that it be transmitted separately from the request message. Therefore, the request URI is listed independently.

Table 1 URI parameter description

Parameter

Description

URI-scheme

Protocol used to transmit requests. All APIs use HTTPS.

Endpoint

Specifies the domain name or IP address of the server bearing the REST service endpoint.

The operations API endpoint for partner is bss-intl.myhuaweicloud.com.

NOTE:
  • This endpoint is a global endpoint and can be used for all regions in Huawei Cloud (International Website).
  • TLS 1.2 supported.

resource-path

Resource path, that is, the API access path. Obtain the path from the URI of the API. For example, the resource-path of the API for creating a customer is /v2/partners/sub-customers.

query-string

Query parameter, which is optional. Ensure that a question mark (?) is included before each query parameter that is in the format of "Parameter name=Parameter value". For example, ?limit=10 indicates that a maximum of 10 data records will be displayed.

For example, to obtain the request URI for creating a customer, obtain the corresponding resource-path (/v2/partners/sub-customers). Then, construct the URI as follows:

https://bss-intl.myhuaweicloud.com/v2/partners/sub-customers 

NOTE:

To simplify URI display, each API is provided with only resource-path and the request method. This is because the URI-scheme value of all APIs is HTTPS, and the endpoints in a region are the same. Therefore, the two parts are omitted.

Request Method

The HTTP protocol defines the following request methods that can be used to send a request to the server:
Table 2 HTTP methods

Method

Description

GET

Requests a server to return a specified resource.

PUT

Requests a server to update a specified resource.

POST

Requests a server to add a resource or perform a special operation.

DELETE

Requests a server to delete a specified resource (for example, an object).

HEAD

Requests a server resource header.

PATCH

Requests a server to update partial content of a specified resource.

If the resource does not exist, the PATCH method is used to create a new resource.

As shown in the URI for creating a customer, the request method is POST. The request URI is as follows:

1
POST https://bss-intl.myhuaweicloud.com/v2/partners/sub-customers 

Request Header

You can also add additional fields to the request header, for example, the fields required by a specified URI and an HTTP method. Table 3 lists common request header fields.
Table 3 Common request header fields

Field

Description

Mandatory

Example

Host

Specifies the server domain name and port number of the resources being requested. The value can be obtained from the URL of the service API. If the port number is not specified, the default port is used. The default port number for https is 443.

No

This field is mandatory only when AK/SK is used for authentication.

bss-intl.myhuaweicloud.com

or

bss-intl.myhuaweicloud.com:443

Content-Type

Specifies the request body MIME type. You are advised to use the default value application/json. For an object or image upload API, the value varies depending on the flow type.

Yes

application/json

Content-Length

Length of the request body. The unit is byte.

No

3495

X-Auth-Token

Specifies the user token.

For details about how to obtain a token, see Token Authentication.

No

This field is mandatory only when the token is used for authentication.

The following is part of an example token: MIIPAgYJKoZIhvcNAQcCoIIO8zCCDu8CAQExDTALBglghkgBZQMEAgEwgg1QBgkqhkiG9w0BBwGggg1BBIINPXsidG9rZ

NOTE:

In addition to supporting authentication using tokens, APIs support authentication using AK/SK, which uses SDK to sign a request. During the signature, the Authorization (signature authentication) and X-Sdk-Date (time when a request is sent) headers are automatically added to the request.

For more details, see Authentication Using AK/SK in Authentication.

The request of the interface for creating a customer is as follows after the request header is added:

POST https://bss-intl.myhuaweicloud.com/v2/partners/sub-customers 
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

(Optional) Request Body

This part is optional. A request body is often sent in a structured format (for example, JSON or XML) as defined in the Content-Type header field. If the request body contains Chinese characters, these characters must be coded in UTF-8.

Request bodies vary with API. Some APIs do not require a request body, such as the APIs requested using the GET and DELETE methods.

In the case of the API used to create a customer, you can obtain the required request parameters and parameter description from the API request. The following is a request carrying the message body, where the request parameters vary with actual condition.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
POST  https://bss-intl.myhuaweicloud.com/v2/partners/sub-customers HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

{
  "domain_name": "test",
  "email": "xxx@huawei.com",
  "verification_code": "253xxx",
  "domain_area": "HK",
  "xaccount_id": "35reyxxxx",
  "xaccount_type": "xxx_IDP",
  "password": "xxxxxxx",
  "is_close_market_ms": "true",
  "cooperation_type": "1"
  
}

If all data required for the API request is available, you can send the request to call the API through curl, Postman, or coding.

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