BKN 知识网络 · 值类型 API (0.1.0)

Download OpenAPI specification:

Value types of a knowledge network (BKN specification 3.0, section 16). A value type is a base type with a set of value rules (an enum, or a range, a length, a pattern and a unit), named so that several data properties can share it: a property names one in constraints.value_type.

Value types have no authorization of their own. Reads and lists need view_detail on the knowledge network; creating, updating and deleting need modify on it. See ../knowledge-network-authorization.md.

The rules are checked with the checks a BKN 3.0 import runs: base_type is one of the listed types, an enum goes with none of range, length and pattern, enum values fit the base type and do not repeat. A data property that names a value type must have the value type's base_type as its Type, and writes no range, length, pattern or unit of its own.

While a data property names a value type, the value type cannot be deleted, and an update must keep a base_type the referencing properties fit. Either refusal is 409 BknBackend.ValueType.Referenced, and its details list the referencing object types and properties.

All APIs are exposed under /api/bkn-backend/v1, require OAuth2 authentication, and default the branch query parameter to main. Writes are recorded in the operation audit. Resource IDs use lowercase letters, digits, underscores, and hyphens, start with a letter or digit, and contain at most 128 characters. Resource names contain at most 128 Unicode characters.

ValueType

Create value types in batch

Creates or imports value types. Requires an application/json content type.

Authorizations:
OAuth2
path Parameters
kn_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Business knowledge network ID

query Parameters
branch
string
Default: "main"

Branch name. Defaults to main.

import_mode
string
Default: "normal"
Enum: "normal" "ignore" "overwrite"

normal reports an existing ID or name; ignore skips existing items; overwrite replaces the value type of the same ID and refuses a name another value type holds.

Request Body schema: application/json
required
required
Array of objects (ValueTypeInput)

Responses

Request samples

Content type
application/json
{
  • "entries": [
    ]
}

Response samples

Content type
application/json
[
  • {
    }
]

List value types

Lists the value types of a knowledge network with pagination and optional name or tag filtering.

Authorizations:
OAuth2
path Parameters
kn_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Business knowledge network ID

query Parameters
branch
string
Default: "main"

Branch name. Defaults to main.

name_pattern
string

Fuzzy match by name or ID. Defaults to empty.

tag
string

Fuzzy match by tag. Defaults to empty.

offset
integer <int64>
Default: 0

Offset, greater than or equal to 0. Defaults to 0.

limit
integer <int64>
Default: 10

Page size in the range [1, 1000]. A value of -1 returns all items without pagination.

sort
string
Default: "update_time"
Enum: "name" "update_time"
direction
string
Default: "desc"
Enum: "asc" "desc"

Responses

Response samples

Content type
application/json
{
  • "entries": [
    ],
  • "total_count": 0
}

Get a value type

Authorizations:
OAuth2
path Parameters
kn_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Business knowledge network ID

vt_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Value type ID

query Parameters
branch
string
Default: "main"

Branch name. Defaults to main.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "tags": [
    ],
  • "comment": "string",
  • "icon": "string",
  • "color": "string",
  • "base_type": "string",
  • "enum": [
    ],
  • "range": {
    },
  • "length": {
    },
  • "pattern": "string",
  • "unit": "string",
  • "kn_id": "string",
  • "branch": "string",
  • "module_type": "string",
  • "creator": {
    },
  • "create_time": 0,
  • "updater": {
    },
  • "update_time": 0
}

Update a value type

Fully updates one value type; the ID comes from the path. Requires an application/json content type.

Authorizations:
OAuth2
path Parameters
kn_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Business knowledge network ID

vt_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Value type ID

query Parameters
branch
string
Default: "main"

Branch name. Defaults to main.

Request Body schema: application/json
required
id
string <= 128 characters ^$|^[a-z0-9][a-z0-9_-]{0,127}$

Optional on creation; generated when empty. Ignored on update.

name
required
string <= 128 characters

Name, unique in the network, with a maximum length of 128 Unicode characters

tags
Array of strings
comment
string
icon
string
color
string
base_type
required
string
Enum: "string" "keyword" "integer" "unsigned integer" "float" "decimal" "date" "datetime" "timestamp"
Array of objects (ValueTypeEnumItem)

The valid values. Goes with none of range, length and pattern.

object

Closed interval; numbers for a numeric base type, ISO 8601 text for a date or time base type.

object

Closed interval on the number of characters.

pattern
string

Regular expression the whole value matches

unit
string

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "tags": [
    ],
  • "comment": "string",
  • "icon": "string",
  • "color": "string",
  • "base_type": "string",
  • "enum": [
    ],
  • "range": {
    },
  • "length": {
    },
  • "pattern": "string",
  • "unit": "string"
}

Response samples

Content type
application/json
{
  • "error_code": "string",
  • "description": "string",
  • "error_details": null,
  • "metadata": { }
}

Delete a value type

Authorizations:
OAuth2
path Parameters
kn_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Business knowledge network ID

vt_id
required
string <= 128 characters ^[a-z0-9][a-z0-9_-]{0,127}$

Value type ID

query Parameters
branch
string
Default: "main"

Branch name. Defaults to main.

Responses

Response samples

Content type
application/json
{
  • "error_code": "string",
  • "description": "string",
  • "error_details": null,
  • "metadata": { }
}