From ad26445a08d06b7aeae4063435c4516435fc5a79 Mon Sep 17 00:00:00 2001 From: Swadeep Date: Tue, 16 Dec 2025 21:02:15 +0530 Subject: [PATCH 1/2] docs: update VertexLabel API examples to match HugeGraph v1.5.0 --- .../docs/clients/restful-api/vertexlabel.md | 221 +++++++----------- 1 file changed, 84 insertions(+), 137 deletions(-) diff --git a/content/en/docs/clients/restful-api/vertexlabel.md b/content/en/docs/clients/restful-api/vertexlabel.md index 241497098..2992e323e 100644 --- a/content/en/docs/clients/restful-api/vertexlabel.md +++ b/content/en/docs/clients/restful-api/vertexlabel.md @@ -8,6 +8,11 @@ weight: 3 Assuming that the PropertyKeys listed in 1.1.3 have already been created. +**Note:** +The following examples are verified against HugeGraph Server v1.5.0. +PropertyKeys must be created before creating a VertexLabel. +When running HugeGraph via Docker with the PASSWORD parameter, authentication is enabled and requests must use Basic Auth. + Params Description: - id: The ID value of the vertex type. @@ -16,7 +21,7 @@ Params Description: - properties: The property types associated with the vertex type. - primary_keys: The primary key properties. This field must have a value when the ID strategy is PRIMARY_KEY, and must be empty for other ID strategies. - enable_label_index: Whether to enable label indexing. It is disabled by default. -- index_names: The indexes created for the vertex type. See details in section 3.4. +- index_labels: The indexes created for the vertex type. See details in section 3.4. - nullable_keys: Nullable properties. - user_data: Setting the common information of the vertex type, similar to the property type. @@ -32,46 +37,38 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age"], + "primary_keys": ["name"], + "nullable_keys": [], + "enable_label_index": true } ``` ##### Response Status ```json -201 +201 Created ``` ##### Response Body ```json { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person2", - "index_names": [ - ], - "properties": [ - "name", - "age" - ], - "nullable_keys": [ - ], - "enable_label_index": true, - "user_data": {} + "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", + "primary_keys": ["name"], + "nullable_keys": [], + "index_labels": [], + "properties": ["name", "age"], + "status": "CREATED", + "ttl": 0, + "enable_label_index": true, + "user_data": { + "~create_time": "2025-12-16 15:08:57.458" + } } ``` @@ -79,18 +76,13 @@ Starting from version v0.11.2, hugegraph-server supports Time-to-Live (TTL) func ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "ttl": 86400000, - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age"], + "primary_keys": ["name"], + "nullable_keys": [], + "ttl": 86400000, + "enable_label_index": true } ``` @@ -98,20 +90,14 @@ Additionally, if the vertex has a property called "createdTime" and you want to ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age", - "createdTime" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "ttl": 86400000, - "ttl_start_time": "createdTime", - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age", "createdTime"], + "primary_keys": ["name"], + "nullable_keys": [], + "ttl": 86400000, + "ttl_start_time": "createdTime", + "enable_label_index": true } ``` @@ -131,14 +117,12 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "name": "person", - "properties": [ - "city" - ], - "nullable_keys": ["city"], - "user_data": { - "super": "animal" - } + "name": "person", + "properties": ["city"], + "nullable_keys": ["city"], + "user_data": { + "super": "animal" + } } ``` @@ -152,26 +136,17 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], - "properties": [ - "city", - "name", - "age" - ], - "nullable_keys": [ - "city" - ], - "enable_label_index": true, - "user_data": { - "super": "animal" - } + "id": 1, + "primary_keys": ["name"], + "id_strategy": "PRIMARY_KEY", + "name": "person", + "index_labels": [], + "properties": ["city", "name", "age"], + "nullable_keys": ["city"], + "enable_label_index": true, + "user_data": { + "super": "animal" + } } ``` @@ -193,50 +168,23 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "vertexlabels": [ - { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], - "properties": [ - "city", - "name", - "age" - ], - "nullable_keys": [ - "city" - ], - "enable_label_index": true, - "user_data": { - "super": "animal" - } - }, - { - "id": 2, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "software", - "index_names": [ - ], - "properties": [ - "price", - "name", - "lang" - ], - "nullable_keys": [ - "price" - ], - "enable_label_index": false, - "user_data": {} - } - ] + "vertexlabels": [ + { + "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", + "primary_keys": ["name"], + "nullable_keys": [], + "index_labels": [], + "properties": ["name", "age"], + "status": "CREATED", + "ttl": 0, + "enable_label_index": true, + "user_data": { + "~create_time": "2025-12-16 15:08:57.458" + } + } + ] } ``` @@ -257,26 +205,25 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ##### Response Body ```json + { "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", "primary_keys": [ "name" ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], + "nullable_keys": [], + "index_labels": [], "properties": [ - "city", "name", "age" ], - "nullable_keys": [ - "city" - ], + "status": "CREATED", + "ttl": 0, "enable_label_index": true, "user_data": { - "super": "animal" + "~create_time": "2025-12-16 15:08:57.458" } } ``` @@ -301,7 +248,7 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexl ```json { - "task_id": 1 + "task_id": 1 } ``` From ddb812495dc527105a5119f692782aea16cb8690 Mon Sep 17 00:00:00 2001 From: Swadeep Date: Wed, 17 Dec 2025 10:34:45 +0530 Subject: [PATCH 2/2] update VertexLabel API docs in EN & CN to match HugeGraph v1.5.0 --- .../docs/clients/restful-api/vertexlabel.md | 235 +++++++----------- 1 file changed, 88 insertions(+), 147 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertexlabel.md b/content/cn/docs/clients/restful-api/vertexlabel.md index 31ff5a7eb..4ec9280e2 100644 --- a/content/cn/docs/clients/restful-api/vertexlabel.md +++ b/content/cn/docs/clients/restful-api/vertexlabel.md @@ -7,6 +7,11 @@ weight: 3 ### 1.3 VertexLabel 假设已经创建好了 1.1.3 中列出来的 PropertyKeys +**注意:** +以下示例基于 HugeGraph Server v1.5.0 版本验证。 +在创建 VertexLabel 之前,必须先创建对应的 PropertyKey。 +当通过 Docker 并设置 PASSWORD 参数运行 HugeGraph 时,会自动开启认证, +此时请求需要使用 Basic Auth。 Params 说明 @@ -16,7 +21,7 @@ Params 说明 - properties: 顶点类型关联的属性类型 - primary_keys: 主键属性,当 ID 策略为 PRIMARY_KEY 时必须有值,其他 ID 策略时必须为空; - enable_label_index:是否开启类型索引,默认关闭 -- index_names:顶点类型创建的索引,详情见 3.4 +- index_labels:顶点类型创建的索引,详情见 3.4 - nullable_keys:可为空的属性 - user_data:设置顶点类型的通用信息,作用同属性类型 @@ -32,17 +37,12 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age"], + "primary_keys": ["name"], + "nullable_keys": [], + "enable_label_index": true } ``` @@ -56,22 +56,19 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab ```json { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person2", - "index_names": [ - ], - "properties": [ - "name", - "age" - ], - "nullable_keys": [ - ], - "enable_label_index": true, - "user_data": {} + "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", + "primary_keys": ["name"], + "nullable_keys": [], + "index_labels": [], + "properties": ["name", "age"], + "status": "CREATED", + "ttl": 0, + "enable_label_index": true, + "user_data": { + "~create_time": "2025-12-16 15:08:57.458" + } } ``` @@ -79,18 +76,13 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "ttl": 86400000, - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age"], + "primary_keys": ["name"], + "nullable_keys": [], + "ttl": 86400000, + "enable_label_index": true } ``` @@ -98,20 +90,14 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab ```json { - "name": "person", - "id_strategy": "DEFAULT", - "properties": [ - "name", - "age", - "createdTime" - ], - "primary_keys": [ - "name" - ], - "nullable_keys": [], - "ttl": 86400000, - "ttl_start_time": "createdTime", - "enable_label_index": true + "name": "person", + "id_strategy": "PRIMARY_KEY", + "properties": ["name", "age", "createdTime"], + "primary_keys": ["name"], + "nullable_keys": [], + "ttl": 86400000, + "ttl_start_time": "createdTime", + "enable_label_index": true } ``` @@ -131,14 +117,12 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "name": "person", - "properties": [ - "city" - ], - "nullable_keys": ["city"], - "user_data": { - "super": "animal" - } + "name": "person", + "properties": ["city"], + "nullable_keys": ["city"], + "user_data": { + "super": "animal" + } } ``` @@ -152,26 +136,17 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], - "properties": [ - "city", - "name", - "age" - ], - "nullable_keys": [ - "city" - ], - "enable_label_index": true, - "user_data": { - "super": "animal" - } + "id": 1, + "primary_keys": ["name"], + "id_strategy": "PRIMARY_KEY", + "name": "person", + "index_labels": [], + "properties": ["city", "name", "age"], + "nullable_keys": ["city"], + "enable_label_index": true, + "user_data": { + "super": "animal" + } } ``` @@ -193,50 +168,23 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "vertexlabels": [ - { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], - "properties": [ - "city", - "name", - "age" - ], - "nullable_keys": [ - "city" - ], - "enable_label_index": true, - "user_data": { - "super": "animal" - } - }, - { - "id": 2, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "software", - "index_names": [ - ], - "properties": [ - "price", - "name", - "lang" - ], - "nullable_keys": [ - "price" - ], - "enable_label_index": false, - "user_data": {} - } - ] + "vertexlabels": [ + { + "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", + "primary_keys": ["name"], + "nullable_keys": [], + "index_labels": [], + "properties": ["name", "age"], + "status": "CREATED", + "ttl": 0, + "enable_label_index": true, + "user_data": { + "~create_time": "2025-12-16 15:08:57.458" + } + } + ] } ``` @@ -258,26 +206,19 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe ```json { - "id": 1, - "primary_keys": [ - "name" - ], - "id_strategy": "PRIMARY_KEY", - "name": "person", - "index_names": [ - ], - "properties": [ - "city", - "name", - "age" - ], - "nullable_keys": [ - "city" - ], - "enable_label_index": true, - "user_data": { - "super": "animal" - } + "id": 1, + "name": "person", + "id_strategy": "PRIMARY_KEY", + "primary_keys": ["name"], + "nullable_keys": [], + "index_labels": [], + "properties": ["name", "age"], + "status": "CREATED", + "ttl": 0, + "enable_label_index": true, + "user_data": { + "~create_time": "2025-12-16 15:08:57.458" + } } ``` @@ -301,7 +242,7 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexl ```json { - "task_id": 1 + "task_id": 1 } ```