Updated on 2025-08-13 GMT+08:00

Creating a User-Defined Parsing Rule

Function

This API is used to create user-defined parsing rules. The parsing rules are used to parse the text to be used as subtitles. The rules are verified from top to bottom.

URI

POST /v1/koosearch/rule-regex

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

Token used for API authentication. For how to obtain the token, see section 3.2 "Authentication."

Constraints:

N/A.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

regexs

Yes

Array of strings

Rule list

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Rule ID.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

POST https://{endpoint}/v1/koosearch/rule-regex

{
  "regexs" : [ "^(\\d+)\\s*[\\u4e00-\\u9fa5]+$", "^(\\d+)(\\.\\d+)\\s*[\\u4e00-\\u9fa5]+$", "^(\\d+)(\\.\\d+)(\\.\\d+)\\s*[\\u4e00-\\u9fa5]+$", "^(\\d+)(\\.\\d+)(\\.\\d+)(\\.\\d+)\\s*[\\u4e00-\\u9fa5]+$" ]
}

Example Responses

Status code: 200

Creation succeeded.

{
  "id" : "1777619994213965826"
}

Status Codes

Status Code

Description

200

Creation succeeded.

400

Incorrect request body parameter

500

Internal error

Error Codes

See Error Codes.