Skip to content

Create



POST /api/v1/self_built_checker/create

Overview

Register a self-built checker and its associated function and Alert Policies.

Before Calling and Usage Steps

First confirm that the function is deployed and available, generate a stable non-empty refKey for this business instance (≤48 characters recommended), and provide the complete title and function metadata. Creation fails if refKey duplicates that of any non-deleted Rule in the current Workspace; the title shares duplicate name validation with regular monitors/self-built checkers. Alert Policies retain only valid matches; invalid input UUIDs may be silently removed, so read the list to confirm. Creation does not support internal parameters such as monitorUUID, extend, or callKwargs. The primary rule is committed before policy relationships are added; if a later step fails, the primary rule may already have been created while the policy association is incomplete. First read back by refKey and verify alertPolicyInfos from the list before deciding whether to retry, to avoid duplicate creation colliding on refKey.

The API registers/modifies checker metadata and Alert Policy associations; it does not execute the associated function, produce a checker result, or create a scheduled trigger task for the self-built checker; actual scheduling and event generation are handled by the business integration/function side. After success, use list/get to verify the configuration and status.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the Workspace.
Example: <DF-API-KEY>
How to obtain or enter: Obtain an OpenAPI Key with the required permissions from API Key Management in the target Workspace.

Body Request Parameters

Parameter Name Type Required Description
alertPolicyUUIDs[*] string A non-empty string is recommended; this is not a name, notification target, or notification policy UUID.
Example: altpl_example
How to obtain or enter: UUID of a single Alert Policy in the current Workspace.
refFuncInfo.args[*] JSON Metadata for any JSON parameter; the server does not provide a unified schema for sub-items; keep the original definition.
Example: service
How to obtain or enter: Metadata for a single parameter from the function platform; depending on the function definition, it can be a string or an object.
refFuncInfo.kwargs. any Dynamic key-value pairs; there is no required parameter common to all functions; do not pass credentials in examples/logs.
Example: production
How to obtain or enter: For example, set service to the name of a service deployed in the business; for the specific name/type/source, refer to the documentation of the associated function.
alertPolicyUUIDs array Optional. On creation, omit or set to [] for no policy binding; on modification, omit to keep the existing binding, or set to [] to clear it. The server retains only matching non-deleted items in the current Workspace; it does not guarantee that all input items are valid, and disabled policies may also be retained. Check the final alertPolicyInfos in the list, and do not treat success as proof that notifications have been delivered.
Allows null: False
Example: ["altpl_example"]
How to obtain or enter: Obtain the UUID of a non-deleted policy in the current Workspace from the Alert Policy list.
refKey string Y Required in the creation declaration and cannot be changed afterward; non-empty and ≤48 characters are recommended. Creation checks for duplicates against the refKey of all non-deleted Rules in the current Workspace, not only self-built checkers. get can be used with refKey alone; modify requires first using get to obtain ruleUUID before submission, and refKey is only an optional additional verification condition; refKey alone cannot reliably maintain policy references/cache/mute scope and duplicate name validation.
Allows null: False
Example: custom-healthcheck-production
How to obtain or enter: Generate a stable unique key for the function/business integration, for example an identifier for a check instance in the same business system.
title string Y Required on creation; optional on modification, where omitting it keeps the existing value. A non-empty title is copied to jsonScript.name and shares name uniqueness with regular triggers and the self_built_trigger group. Use an appropriate length; the public declaration sets no upper limit, and the title is not generated by the server; it is not the function funcId.
Allows null: False
Example: 生产服务健康检查
How to obtain or enter: Named by the business side; first check existing names of regular monitors and self-built checkers.
refFuncInfo json Y Required on creation, and funcId is required; this only registers metadata for the associated function and does not execute the function or create scheduled dispatch in this request. Modification accepts only the metadata subfields listed on this page, updates them by first-level key, and replaces args/kwargs as a whole; {} or omission leaves them unchanged. funcId is not in the modify allowlist and cannot be used to change the function identifier through modification.
Allows null: False
Example: {"funcId": "healthcheck.main", "description": "生产服务健康检查函数。", "definition": "main(service)", "category": "custom", "args": ["service"], "kwargs": {"service": "production"}}
How to obtain or enter: Obtain metadata from a deployed and available custom checker function/function platform configuration; do not treat the example literals as a real function.
refFuncInfo.funcId string Y Required only on creation and not declared for modification; server registration does not guarantee that the function exists or is callable.
Allows null: False
Example: healthcheck.main
How to obtain or enter: Obtain the complete ID from the real deployed function configuration.
refFuncInfo.description string Optional string; can be empty; on modification, an explicit empty string clears it.
Allows null: False
Allows empty string: True
Example: 生产服务健康检查函数。
How to obtain or enter: Use the function description documentation.
refFuncInfo.definition string Optional signature display string; this is not source code executed by this API.
Allows null: False
Allows empty string: True
Example: main(service)
How to obtain or enter: Obtain it from the exported description of the function definition/signature.
refFuncInfo.category string Optional metadata; no fixed enumeration, and it does not change Rule.type.
Allows null: False
Example: custom
How to obtain or enter: Use the actual category name from the function platform.
refFuncInfo.args array Optional array; stored according to the original metadata conventions of the function platform. The server does not perform parameter binding or validate the function signature; modification replaces the entire array.
Allows null: False
Example: ["service"]
How to obtain or enter: Obtain positional parameter metadata from the function parameter signature.
refFuncInfo.kwargs json Optional dynamic JSON metadata; sub-values are interpreted according to the function definition. This is not the top-level callKwargs parameter available in this API and does not immediately invoke the function. Modification replaces the entire kwargs object.
Allows null: False
Example: {"service": "production"}
How to obtain or enter: Obtain it from the function parameter metadata or business integration configuration.
isDisabled boolean Optional on creation; default false. true sets the initial status to 2, and false sets it to 0. Modification does not accept this field; use the enable/disable API.
Allows null: False
Example: false
How to obtain or enter: Set to true when the checker needs to be registered but not enabled.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/self_built_checker/create' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"refKey":"custom-healthcheck-production","title":"生产服务健康检查","refFuncInfo":{"funcId":"healthcheck.main","description":"生产服务健康检查函数。","definition":"main(service)","category":"custom","args":["service"],"kwargs":{"service":"production"}},"alertPolicyUUIDs":["altpl_example"],"isDisabled":false}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content.id integer or null Record ID; it may be null in snapshots before creation is committed; use uuid for operations.
content.uuid string rul_ rule UUID.
content.workspaceUUID string Workspace to which the record belongs.
content.monitorUUID string UUID of the associated monitor group; not declared for public creation and usually an empty string.
content.type string Fixed to self_built_trigger for self-built checkers; get does not impose an additional type restriction and only uses the UUIDs listed in this module.
content.refKey string Stable business association key.
content.secret string or null Compatibility field for shared entities; usually empty for self-built checkers. It may be null in creation snapshots and is not used as a calling credential.
content.jsonScript object Stored definition of the self-built checker; distinct from Rule.type.
content.jsonScript.type string Fixed to selfBuiltCheck.
content.jsonScript.title string Root business title.
content.jsonScript.name string Optional. If title is empty on creation, it is not generated; a non-empty title is copied to name; if title is set to empty on modification, the historical name is retained.
content.jsonScript.refFuncInfo object Metadata for the associated function.
content.jsonScript.refFuncInfo.funcId string Required only on creation and not declared for modification; server registration does not guarantee that the function exists or is callable.
content.jsonScript.refFuncInfo.description string Optional string; can be empty; on modification, an explicit empty string clears it.
content.jsonScript.refFuncInfo.definition string Optional signature display string; this is not source code executed by this API.
content.jsonScript.refFuncInfo.category string Optional metadata; no fixed enumeration, and it does not change Rule.type.
content.jsonScript.refFuncInfo.args array Optional array; stored according to the original metadata conventions of the function platform. The server does not perform parameter binding or validate the function signature; modification replaces the entire array.
content.jsonScript.refFuncInfo.kwargs json Optional dynamic JSON metadata; sub-values are interpreted according to the function definition. This is not the top-level callKwargs parameter available in this API and does not immediately invoke the function. Modification replaces the entire kwargs object.
content.jsonScript.refFuncInfo.args[] JSON Metadata for any JSON parameter; the server does not provide a unified schema for sub-items; keep the original definition.
content.jsonScript.refFuncInfo.kwargs. any Dynamic key-value pairs; there is no required parameter common to all functions; do not pass credentials in examples/logs.
content.jsonScript.callKwargs object Execution parameters that may be stored by legacy/other entry points; public create/modify does not declare them, and they cannot be passed back or newly added.
content.jsonScript.callKwargs. JSON Specific execution parameters are interpreted according to the original function definition and are not guaranteed to exist.
content.crontabInfo object Self-built checkers do not create scheduled trigger configurations through this entry point; usually {}.
content.crontabInfo. JSON Legacy records may retain scheduling data; this is not a writable configuration for this API.
content.extend object Extended metadata; not declared in the public Body and usually {} on creation.
content.extend. JSON Extended fields saved in legacy records; this entry point does not support returning them for modification.
content.createdWay string Usually manual; may also be legacy import/template/empty.
content.isLocked integer or boolean Lock flag.
content.openPermissionSet boolean Custom operation permission switch; false on creation, and reset to false after a shared task update via modify.
content.permissionSet array<string> Operation permission principals; [] on creation, and reset to [] after a shared update via modify.
content.permissionSet[] string Legacy account/team/role identifiers.
content.status integer 0 enabled, 2 disabled, 3 deleted; this is not the latest checker result.
content.creator string Creator identity.
content.updator string Updater identity; may be empty initially.
content.createAt integer Creation Unix time in seconds.
content.updateAt integer Update Unix time in seconds; -1 if not updated.
content.deleteAt integer Deletion Unix time in seconds; -1 if not deleted.
content.declaration object Public declaration.
{
  "code": 200,
  "content": {
    "id": null,
    "uuid": "rul_self_example",
    "workspaceUUID": "wksp_example",
    "monitorUUID": "",
    "type": "self_built_trigger",
    "refKey": "custom-healthcheck-production",
    "secret": null,
    "jsonScript": {
      "type": "selfBuiltCheck",
      "title": "生产服务健康检查",
      "name": "生产服务健康检查",
      "refFuncInfo": {
        "funcId": "healthcheck.main",
        "description": "生产服务健康检查函数。",
        "definition": "main(service)",
        "category": "custom",
        "args": [
          "service"
        ],
        "kwargs": {
          "service": "production"
        }
      }
    },
    "crontabInfo": {},
    "extend": {},
    "createdWay": "manual",
    "isLocked": 0,
    "openPermissionSet": false,
    "permissionSet": [],
    "status": 0,
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": -1,
    "deleteAt": -1,
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Invalid request JSON syntax Request JSON format error Correct the JSON according to content.reason, line, and column.
406 ft.CheckObjectNameRepeat The title duplicates the name of a non-deleted regular monitor/self-built checker in the current Workspace Duplicate alias of the detection target Use a different name; for modifications, include ruleUUID to exclude the current object first.
500 ft.InternalServerError Target not selected, invalid field shape or length, database failure, or failure to dispatch an asynchronous task after commit Internal error First read back the current rule to confirm whether it has been saved; then retry with an explicit ruleUUID in the current Workspace and provide traceId.
400 ft.SelfBuiltCheckerRefKeyExists A non-deleted rule in the current Workspace already has the same refKey A self-built monitor with the same refKey already exists Reuse the existing rule UUID or generate a new stable business key.

Feedback

Is this page helpful?