更新时间:2022-02-22 GMT+08:00

更新label

功能介绍

当前版本的更新label仅支持向已经存在的label末尾追加property,不支持删除已有property,也不支持更新property顺序。

URI

  • URI格式
    POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}/properties
  • 参数说明
    表1 URI参数说明

    参数

    是否必选

    类型

    说明

    project_id

    String

    项目编号,用于资源隔离。请参考获取项目ID

    graph_name

    String

    图名称。

    label_name

    String

    Label名称。

请求

  • 请求样例
    POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}/properties
    {
      "name": "book",
      "properties": [
        {
          "property": {
            "name": "Title",
            "cardinality": "single",
            "dataType": "string"
          }
        },
        {
          "property": {
            "name": "Version",
            "cardinality": "single",
            "dataType": "string"
          }
        },
        {
          "property": {
            "name": "Category",
            "typeName1": "science",
            "typeName2": "literature",
            "typeNameCount": "2",
            "dataType": "enum"
          }
        }
      ]
    }

SERVER_URL:图的访问地址,取值请参考业务面API使用限制

  • Body参数说明
    表2 Body参数说明

    参数

    是否必选

    类型

    说明

    name

    String

    label名称。

    label name的长度不能超过256。

    label name只允许字符,数字,空格,%,@,#,$,:,?,*,.,+,- 和 _符号。

    properties

    Json

    待追加的属性数组。数组元素为property,具体参数介绍请见表3

    表3 property参数说明

    参数

    是否必选

    类型

    说明

    name

    String

    属性名称。

    1. property name的长度不能超过256。
    2. property name不允许包含<, >, &, ascci码14,15和30。
    3. 同一个label下不允许存在相同的property。

    cardinality

    String

    属性的复合类型,包括:

    • single
    • list
    • set

    dataType

    String

    属性的数据类型。具体请参考表1中的元数据类型。

    typeNameCount

    否(若dataType为enum,则必选)

    String

    enum类型参数的总数。由该选项控制typeName的个数。

    typeName*

    否(若dataType为enum,则必选)

    String

    enum类型参数名称。例如typeNameCount为2,则参数包含typeName1:science,typeName2:literature。

响应

  • 要素说明
    表4 要素说明

    参数

    是否必选

    类型

    说明

    errorMessage

    String

    系统提示信息,执行成功时,字段可能为空。执行失败时,用于显示错误信息。

    errorCode

    String

    系统提示信息,执行成功时,字段可能为空。执行失败时,用于显示错误码。

    result

    String

    成功时result值为success。

  • 请求成功样例
    Http Status Code: 200
    {
     "result": "success"
    }
  • 请求失败样例
    Http Status Code: 400
     {
      "errorMessage": "label already exists",
      "errorCode": "GES.8801"
     }

返回值

  • 正常

    200

  • 异常
    表5 异常返回值说明

    返回值

    说明

    400 Bad Request

    请求错误。

    401 Unauthorized

    鉴权失败。

    403 Forbidden

    没有操作权限。

    404 Not Found

    找不到资源。

    500 Internal Server Error

    服务内部错误。

    503 Service Unavailable

    服务不可用。