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

Calling APIs

Updated on 2024-10-18 GMT+08:00

You can call APIs opened by others in APIG.

Usage Guidelines

An API can be accessed 1,000 times by using the debugging domain name allocated when the API's group is created.

Obtaining API Calling Information

Obtain API calling information from the API provider before you call an API.

  • Request

    On the APIG console, choose API Publishing > APIs. Click an API name to view the domain name, request method, request path, and basic information of the API.

  • API authentication

    Obtain the request authentication information according to the API's authentication mode.

    Authentication Mode

    Authentication Information

    App (signature)

    Obtain the AppKey and AppSecret of the app authorized for the API from the API provider, as well as the signing SDK.

    App (simple authentication)

    Obtain the AppCode of the app authorized for the API from the API provider.

    IAM (token)

    Obtain the username and password for the cloud platform.

    IAM (AK/SK)

    Obtain the AK/SK of an account for the cloud platform and the signing SDK.

    Custom

    Obtain the custom authentication information to carry in request parameters from the API provider.

    None

    No authentication information required.

    • AppKey and AppSecret of the app

      On the shared gateway console, choose API Calling > Apps. In the app list, click the name of the app that the API is authorized to access. On the app details page that is displayed, obtain the AppKey and AppSecret of the app.

    • SDK used for authentication signatures

      On the shared gateway console, choose Help Center > SDK Process Flow, and download the SDK of the desired language.

    • AppCode

      On the shared gateway console, choose API Calling > Apps. In the app list, click the name of the app that the API is authorized to access. On the app details page that is displayed, obtain the AppCode on the AppCodes tab page.

Calling APIs

NOTE:

This section describes only the configuration of the request path and authentication parameters. For other parameters, such as timeout and SSL, configure them as required. To avoid service loss due to incorrect parameters, configure them by referring to the industry standards.

  1. Construct an API request. Example:
    POST https://{Address}/{Path}?{Query}
    {Header}
    
    {
      {Body}
    }
    • POST: request method. Replace it with the request method obtained in Obtaining API Calling Information.
    • {Address}: request address. Replace it with the domain name obtained in Obtaining API Calling Information.

      Scenario

      Request Parameter Configuration

      Calling an API with a domain name

      Call an API using the debugging domain name allocated to the API group or a domain name bound to the group. No additional configuration is required.

      Calling an API with an IP address

      To use an IP address to call an API, add the header parameter host.

    • {Path}: request path. Replace it with the request path obtained in Obtaining API Calling Information.
    • {Query}: (optional) query string in format "Parameter_name=Parameter_value", for example, limit=10. Separate multiple query strings with ampersands (&). For details, see the request parameters obtained in Obtaining API Calling Information.
    • {Header}: request header parameter in format "Parameter_name:Parameter_value", for example, Content-Type:application/json. For details, see the request parameters obtained in Obtaining API Calling Information.
    • {Body}: request body in JSON format. For details, see the request body description obtained in Obtaining API Calling Information.
  1. Add authentication information to the API request.

    Authentication Mode

    Request Parameter Configuration

    App (signature)

    Use the obtained SDK to sign the API request. For details, see Calling APIs Through App Authentication.

    App (simple authentication)

    Add the header parameter X-Apig-AppCode and set the parameter value to the AppCode obtained in Obtaining API Calling Information. For details, see Getting Started.

    IAM (token)

    Obtain a token from the cloud platform and add the header parameter X-Auth-Token with the token as the value. For details, see Token Authentication.

    IAM (AK/SK)

    Use the obtained SDK to sign the API request. For details, see AK/SK Authentication.

    Custom

    Add the information required for custom authentication to the API request.

    None

    Call APIs without authentication.

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