BKN 知识网络 · 对象类 API (0.1.0)

Download OpenAPI specification:

Object types use object_type:{kn_id}/{object_type_id}. Reads and lists require view_detail; data reads require query_data; updates and deletes use modify and delete. Lists and searches are filtered before total and pagination. See ../knowledge-network-authorization.md.

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.

With strict_mode=true, resource-backed object types read only the Vega schema under view_detail. Main-branch publication reuses the effective delegator selected by Proxy preflight instead of requiring the current editor to repeat the downstream permission. Missing bindings return 400; a current-user permission denial returns 403; controlled lookup failures return 502, and timeout/unavailable dependencies return 503. Downstream bodies are never copied into the public response. Cypher logical properties use the same 400/502/503 dependency classification.

Strict mode also refuses, with 400 BknBackend.ObjectType.InvalidParameter, a data property whose mapped_field.name is not one of the resource's fields, listing each as property (field). Names match exactly, case included, as a SQL statement binds them. Only resources read through SQL (a table or a logical view) are checked: a dataset or an index may serve a mapped field that is not a top-level field of its schema. Creating, updating and importing (BKN upload, knowledge network import) are checked over all data properties; the data property update endpoint checks only the properties it submits.

Event classes

From 0.2.2 event classes (kinds containing event, configured by event) are part of the Professional edition. The Community edition refuses event as an unsupported kind, the same answer as for any unknown kind.

Refused declarations and references

A save the declaration rules refuse answers 400 BknBackend.ObjectType.InvalidParameter.Declarations. As before, error_details holds the English text (several issues are joined with ; ). metadata.issues holds the same refusal as records, so that a caller words it in its own language and finds the definition and the property:

{
  "error_code": "BknBackend.ObjectType.InvalidParameter.Declarations",
  "error_details": "Semantic end_time needs an event_time property alongside",
  "metadata": {"issues": [{
    "rule": "end_time_without_event_time",
    "object_type_id": "order",
    "message": "Semantic end_time needs an event_time property alongside"
  }]}
}

Each issue has rule (the stable code below), the ID of the definition it concerns (object_type_id, or relation_type_id), property for a rule of one data property, params (the values the message is built from), involved (every definition a rule that spans definitions concerns, as {kind, id}; the first is the definition that refers first and the one named by the ID field) and message (the English text). A rule within one definition lists the first problem it finds. A rule that spans definitions (replaced_by, fallback_for, deprecated endpoints) lists every problem that involves a definition of the save. An alias that names another definition (alias_conflict) reports only the first conflict.

A delete refused because definitions still refer to it answers 409 BknBackend.ObjectType.StillReferenced. error_details.references lists the English sentences, as before. metadata.references holds one record per reference: kind and id name what is referred to, referrer_kind and referrer_id who refers to it, via the declaration (replaced_by or fallback_for), and message the English sentence.

Rules of this definition kind:

  • Property semantics: semantic_unknown (semantic, allowed), semantic_type_mismatch (semantic, allowed, type), semantic_duplicated (semantic, other_property), end_time_without_event_time, latitude_longitude_unpaired, location_with_latitude_longitude, crs_mismatch (latitude_crs, longitude_crs).
  • Property constraints: value_type_with_value_rules (value_type), unique_type_unsupported (type), crs_without_geo_semantic, crs_invalid (crs, allowed), timezone_type_mismatch (type), timezone_invalid (timezone), range_bounds_missing, range_not_numeric, range_not_date (type), range_not_time (type), range_min_greater_than_max (min, max), range_min_later_than_max (min, max), range_type_unsupported (type), length_bounds_missing, length_bound_negative (bound), length_type_mismatch (type, allowed), length_min_greater_than_max (min, max), pattern_type_mismatch (type, allowed), pattern_invalid (pattern, error; the expression is not RE2), unit_type_mismatch (type).
  • Value types: value_type_undefined (value_type), value_type_base_mismatch (value_type, base_type, type); both name the property.
  • Aliases of the object type or of a property: aliases_too_many (count, max), alias_empty, alias_full_width_comma (alias), alias_contains_comma (alias), alias_too_long (alias, max), alias_duplicated (alias), alias_equals_own_name (alias), alias_conflict (alias, and conflicts_with or, between two properties, conflicts_with_property).
  • Lifecycle: lifecycle_fields_without_deprecation, lifecycle_reason_missing, lifecycle_replaced_by_invalid (replaced_by), lifecycle_replaced_by_self (replaced_by), lifecycle_status_invalid (status, allowed), and across definitions replaced_by_missing, replaced_by_deprecated (replaced_by).
  • primary_key_required_false: a primary key is written as not required; it is required by definition.
  • Saving a deprecated object type can also refuse on a relation type bound to it: endpoint_deprecated (object_type), with relation_type_id.

List object types

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

query Parameters
name_pattern
string

Fuzzy-match by object type name. Empty by default.

sort
string
Enum: "update_time" "name"

Sort field. Defaults to update_time.

direction
string
Enum: "asc" "desc"

Sort direction. Supported values are asc and desc. Defaults to desc.

offset
integer <int64>

Offset of the first returned item. Must be greater than or equal to 0. Defaults to 0.

limit
integer <int64>

Maximum number of returned items per page. Supported paginated values are 1 to 1000; -1 disables pagination. Defaults to 10.

tag
string

Exact-match by tag. Empty by default.

branch
string
Default: "main"

Branch. Defaults to main.

Responses

Response samples

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

Create or search object types

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

query Parameters
branch
string
Default: "main"

Branch. Defaults to main.

confirm_clear_declarations
boolean
Default: false

With overwrite, a file that does not carry the BKN spec 3.0 declarations of an existing object type (aliases, lifecycle and property declarations), such as a 2.x package or an old JSON export, would clear them. Without this parameter the request is refused with 409 BknBackend.ObjectType.DeclarationsWouldBeCleared, whose details list the declarations; pass true to clear them.

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

Import mode. normal returns an error for a concept with the same name; overwrite replaces it; ignore skips it. Defaults to normal.

strict_mode
boolean
Default: true

Whether to validate dependency existence. Defaults to true.

header Parameters
x-http-method-override
string
Enum: "POST" "GET"

Override request header. Omitted or POST creates object types; GET searches them. Any other value is refused with 400.

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

Object type information

Responses

Request samples

Content type
application/json
Example
{
  • "need_total": true,
  • "limit": 1,
  • "condition": {
    }
}

Response samples

Content type
application/json
Example
{
  • "entries": [
    ],
  • "total_count": 2,
  • "next_cursor": "cursor-object-types-1"
}

Update an object type

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

ob_id
required
string

Object type ID

query Parameters
branch
string

Branch. Uses main when omitted.

strict_mode
boolean
Default: true

Whether to strictly validate dependencies. When true, validates external dependencies such as data views and embedding models. When false, skips this validation.

Request Body schema: application/json
required
name
required
string <= 128 characters

Name

aliases
Array of strings

Other names of the object type (BKN spec 3.0), for concept search and understanding; not its own name or another object type's name. An update that leaves the field out keeps the stored aliases; null or [] clears them.

object

Whether the object type is still in use (BKN spec 3.0, §4.3); not the index status. Without it the object type is active. status deprecated needs a reason; replaced_by names an active object type. An update that leaves the field out keeps the stored lifecycle; null or {} clears it.

tags
Array of strings

Tags used for business identification

comment
string

Comment

icon
string

Icon

color
string

Color

branch
string

Branch ID

Array of objects (ConceptGroup)

Concept groups

object (DataSource)

Data source

required
Array of objects (DataProperty)

Data properties

Array of objects (LogicProperty)

Logical properties

primary_keys
required
Array of strings

Primary keys that uniquely identify the object

display_key
required
string

Display property of the object

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "aliases": [
    ],
  • "lifecycle": {
    },
  • "tags": [
    ],
  • "comment": "string",
  • "icon": "string",
  • "color": "string",
  • "branch": "string",
  • "concept_groups": [
    ],
  • "data_source": {
    },
  • "data_properties": [
    ],
  • "logic_properties": [
    ],
  • "primary_keys": [
    ],
  • "display_key": "string"
}

Response samples

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

Get object type details

Authorizations:
OAuth2
path Parameters
ob_ids
required
Array of strings

Object type ID

kn_id
required
string

Business knowledge network ID

query Parameters
branch
string
Default: "main"

Branch. Defaults to main.

Responses

Response samples

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

Delete object types

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

ob_ids
required
Array of strings

Object type IDs, separated by commas

query Parameters
force_delete
boolean
Default: false

Whether to force deletion. Defaults to false. When false, returns a 400 error if a relation type binds the object type; when true, deletes it without that validation.

branch
string
Default: "main"

Branch. Defaults to main.

Responses

Response samples

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

Update data properties

Requires effective modify on object_type:{kn_id}/{ob_id}. Before the write, strict_mode controls request validation for vector-index embedding-model dependencies and submitted mapped fields; it never bypasses authorization.

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

ob_id
required
string

Object type ID

property_names
required
string

Data property name list

query Parameters
branch
string

Branch. Uses main when omitted.

strict_mode
boolean
Default: true

Whether to strictly validate the embedding model dependency for vector indexes and the submitted mapped fields. Defaults to true. When true and submitted data properties enable vector indexes, verifies that the model exists, has the embedding type, and has valid dimensions and parameters. When true, a submitted property whose mapped field the bound SQL resource does not have is refused with 400; a resource that cannot be read leaves that check out. When false, skips the model-service call and the mapped-field check. Request JSON index configuration validation still applies.

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

Data properties

Responses

Request samples

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

Response samples

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

Validate object types

Validates concept dependency existence only and does not write data. Use it for pre-import checks or batch self-checks. When strict_mode is true, validates dependencies such as data views, vector-index embedding models, and concept groups.

For same-batch references, such as a relation type referencing an object type that has not been persisted, single-type validation recognizes only persisted resources in strict mode when the request cannot include the referenced definition. In that case, use full knowledge-network validation with the same structure as the create API, or concept-group validation with nested object_types and relation_types. The server derives BatchIDIndex from the submitted JSON, making entries visible within the same create transaction. Relation-mapping validation requires object type data properties. If a batch declares only object type IDs without property definitions, existence validation may pass while mapping-rule validation is reduced.

Response: HTTP 200 with valid set to true indicates success. Ordinary model validation failures use valid=false and detail. Strict dependency failures return the documented 400/403/502/503 error envelope, whose error_details includes a safe dependency_kind.

Internal API: POST /api/bkn-backend/in/v1/.../object-types/validation. Other behavior is the same; the caller is resolved from headers and OAuth is not required.

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

query Parameters
branch
string

Branch. Uses main when omitted.

strict_mode
boolean
Default: true

Whether to strictly validate dependencies. Defaults to true.

confirm_clear_declarations
boolean
Default: false

With overwrite, a file that does not carry the BKN spec 3.0 declarations of an existing object type (aliases, lifecycle and property declarations), such as a 2.x package or an old JSON export, would clear them. Without this parameter the request is refused with 409 BknBackend.ObjectType.DeclarationsWouldBeCleared, whose details list the declarations; pass true to clear them.

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

Same as the create object type API. Defines validation semantics for persisted object type ID or name conflicts: normal, ignore, or overwrite.

Request Body schema: application/json
required
entries
Array of objects

Object type list to validate. Its structure is the same as the create API.

Responses

Request samples

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

Response samples

Content type
application/json
{
  • "valid": true,
  • "detail": "string"
}

ObjectType

Read the bound resource fields for mapping

Requires view_detail and modify on the object type. Reads the resource saved on that object type in the selected branch. If Vega denies the caller, the current published binding can be read via the network proxy. A draft can reuse that grant only for the same object and resource. Returns field metadata only.

Authorizations:
OAuth2
path Parameters
kn_id
required
string
ot_ids
required
string

A single object type ID.

query Parameters
branch
string

Responses

Response samples

Content type
application/json
{
  • "resource_id": "string",
  • "schema_definition": [
    ]
}

Get object type sample data

Returns several actual object instances for an object type to verify mappings during modeling. columns gives the display order and titles. The structure of entries elements depends on the object type property definitions, so fixed fields are not declared.

Authorizations:
OAuth2
path Parameters
kn_id
required
string

Business knowledge network ID

ot_ids
required
string

Object type ID

query Parameters
branch
string
Default: "main"

Branch. Defaults to main.

limit
integer
Default: 20

Number of returned entries. Defaults to 20; a value of 0 or less is read as 20 and a value above 100 as 100.

offset
integer
Default: 0

Offset. Defaults to 0.

need_total
boolean
Default: true

Whether to attempt to get the total count. Defaults to true.

search_after
string

Deep-pagination cursor, a JSON array such as [1,"a"]; a value that is not a JSON array is refused with 400. When provided, offset is ignored.

Responses

Response samples

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