You need to enable JavaScript to run this app.
Application Performance Management Plus

Application Performance Management Plus

Copy page
Download PDF
Server monitoring API interface
OpenAPI usage examples
Copy page
Download PDF
OpenAPI usage examples
This topic introduces the demo examples in various programming languages provided by APMPlus to help you quickly call the OpenAPI.​
Prerequisites​
You need to use the signing method from the signature SDK. For SDK addresses in various languages, see V1 version.​
warning​
The sample code is strongly dependent on the signature SDK. Authorization constructed through the signature mechanism cannot be used.​
Sample code​
​
Go
Java
Python
​
​
package main​
​
import (​
"bytes"​
"context"​
"fmt"​
"io"​
"net/http"​
"time"​
​
volc "github.com/volcengine/volc-sdk-golang/base"​
)​
​
const (​
Host = "https://apmplus-openapi.cn-beijing.volcengineapi.com"​
ServiceName = "apmplus_openapi"​
Region = "cn-beijing"​
AK = "xx"​
SK = "xx=="​
)​
​
func main() {​
// 1. Initialize method information​
var (​
action = "GetAppAlarmRuleList" // API name​
version = "2022-10-12" // API version​
appID = "123456" // Application ID​
)​
ctx := context.Background()​
// 2. Construct request body​
req := buildRequest(ctx, action, version, appID)​
// 3. Send request​
cli := &http.Client{Timeout: time.Second * 5}​
resp, err := cli.Do(req)​
if err != nil {​
panic(err)​
}​
defer resp.Body.Close()​
data, _ := io.ReadAll(resp.Body)​
fmt.Println(string(data))​
}​
​
// buildRequest​
func buildRequest(ctx context.Context, action, version, appID string) *http.Request {​
payload := buildRequestJsonBody()​
body := bytes.NewBuffer([]byte(payload))​
​
req, _ := http.NewRequest("POST", Host, body)​
q := req.URL.Query()​
q.Add("Action", action)​
q.Add("Version", version)​
req.URL.RawQuery = q.Encode()​
req.Header.Set("x-app-ids", appID)​
req.Header.Set("content-type", "application/json")​
// Sign signature​
c := volc.Credentials{​
AccessKeyID: AK,​
SecretAccessKey: SK,​
Service: ServiceName,​
Region: Region,​
}​
req = c.Sign(req)​
return req​
}​
​
// buildRequestBody: request body to the current API, in JSON string format​
func buildRequestJsonBody() string {​
return `{​
"monitor_types":[​
"crash"​
],​
"query_key":"test alert",​
"status":[​
],​
"page_no":1,​
"page_size":1​
}`​
}​
​
​
​
When calling the API, please modify the sample code with the corresponding Action, AppID, AK, SK, Service, and Region for the target API.​
​
Last updated: 2026.09.18 16:00:42