All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Request Structure

Last updated:2026-03-18 14:12:49

Kingsoft Cloud Monitor API - General Information

This page provides the essential information required to construct valid requests to the Kingsoft Cloud Monitor OpenAPI, including communication protocols, request structures, common parameters, and response formats.

Communication Protocol & Methods

Protocol

Kingsoft Cloud Monitor APIs support both HTTP and HTTPS.

Security Recommendation: We strongly recommend using HTTPS for all production requests to ensure data encryption and prevent man-in-the-middle attacks.

HTTP Methods

The APIs support the following HTTP methods:

Method

Recommendation

Usage Scenario

POST

Recommended

Preferred for most operations. Supports larger payloads and keeps parameters in the request body (cleaner URLs).

GET

Supported

Suitable for simple data retrieval queries. All parameters must be URL-encoded and appended to the query string.


Request Structure

A valid API request consists of the following core components:

  1. Endpoint: The service URL (e.g., monitor.cn-beijing-1.api.ksyun.com).

  2. Method: The HTTP verb (GET or POST).

  3. Parameters:

    • Common Parameters: Required for every request (e.g., Action, Version, Signature).

    • Action Parameters: Specific to the API operation being called (e.g., Namespace, MetricName).

  4. Encoding: All requests and responses use the UTF-8 character set.

  5. Signature: A cryptographic signature to authenticate the request.

Parameter Encoding Rules

Request Type

Parameter Location

Encoding Requirement

GET

Query String

All parameters (including Signature) must be URL-encoded and appended to the URL.

POST

Body / Header

• Parameters are typically in the request body.• The Signature is usually passed in the Authorization header (AWS SigV4 style).


Common Parameters

Every API request must include the following common parameters. Missing any of these will result in an authentication or validation error.

Parameter

Type

Required

Description

Action

String

The name of the API operation (e.g., GetMetricStatistics, PutMetricData).

Version

String

The API version date. Different modules use different versions:• Custom Monitoring: 2017-07-01Batch Data Retrieval: 2018-11-14Container Engine: 2019-08-12Alarm Policies: 2021-01-01Default/Other: 2010-05-25

Region

String

The region ID where the resource resides (e.g., cn-beijing-1, cn-shanghai-2).

Timestamp

String

The time of the request in ISO 8601 format (e.g., 2026-03-18T12:00:00Z). Used to prevent replay attacks.

Signature

String

The calculated signature string verifying the request's authenticity. See Authentication Guide.

SignatureMethod

String

The signature algorithm used, typically HMAC-SHA256.


Response Format

Data Format

Kingsoft Cloud Monitor APIs return data in XML by default.

  • Default: application/xml

  • JSON: To receive JSON, set the HTTP Header: Accept: application/json.

HTTP Status Codes

  • 200 OK: The request was successful.

  • 4xx Client Errors: The request contains an error (e.g., invalid parameters, auth failure).

  • 5xx Server Errors: An internal server error occurred.

Successful Response Example (XML)

<GetMetricStatisticsResponse>
    <ResponseMetadata>
        <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
    </ResponseMetadata>
    <!-- Specific Data Payload -->
    <Data>
        <Datapoint>
            <Average>45.2</Average>
            <Timestamp>2026-03-18T10:00:00Z</Timestamp>
        </Datapoint>
    </Data>
</GetMetricStatisticsResponse>

Failed Response Example (XML)

When an error occurs, the API returns an <ErrorResponse> block along with the corresponding HTTP status code (4xx or 5xx).

<ErrorResponse>
    <RequestId>a9f1362f-529f-4b72-a22c-426132db9094</RequestId>
    <Error>
        <Type>Sender</Type>
        <Code>MissingParameter</Code>
        <Message>An value must be supplied for the input parameter Namespace.</Message>
    </Error>
</ErrorResponse>

Troubleshooting Tip: If you encounter an unexpected error, please contact Kingsoft Cloud Support and provide the RequestId. This allows our team to trace the specific request logs and resolve the issue quickly.


Common Error Codes

The following table lists common error codes returned by the Cloud Monitor API.

Error Code

HTTP Status

Description

Solution

MissingAuthenticationToken

403

Request lacks required authentication headers or tokens.

Ensure Authorization header or signature parameters are included.

SignatureDoesNotMatch

403

The provided signature does not match the server's calculation.

Verify your Secret Key, signing algorithm, and time synchronization.

InvalidClientTokenId

403

The AccessKey ID provided is invalid or disabled.

Check your AccessKey ID and account status.

AccessDenied

403

User is not authorized to perform the requested action.

Check IAM policies and user permissions.

IncompleteSignature

400

The signature structure is malformed or missing fields.

Ensure all required signature components (Credential, Date, etc.) are present.

InvalidParameterValue

400

A parameter value is out of range or invalid.

Check the API documentation for valid parameter ranges.

MissingParameter

400

A required parameter is missing.

Ensure all mandatory parameters (Action, Version, etc.) are included.

LimitExceeded

409

API rate limit exceeded.

Reduce request frequency or implement exponential backoff.

ServiceUnavailable

500

Temporary service outage or internal error.

Retry the request after a short delay.

DryRunOperation

412

Request validated but not executed due to DryRun flag.

Remove the DryRun parameter to execute the action.


On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback