添加边(2.1.2)
功能介绍
添加边。
URI
参数 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
project_id | 是 | String | 参数解释: 项目编号。获取方法,请参见获取项目ID。 约束限制: 不涉及。 取值范围: 只能由英文字母和数字组成,且长度为[1-64]个字符。 默认取值: 不涉及。 |
graph_name | 是 | String | 图名称。 |
请求参数
参数 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
source | 是 | String | source点名称。 |
target | 是 | String | target点名称。 |
label | 否 | String | 边的label,若没有则置为“__DEFAULT__”。 |
properties | 否 | Object | 各个属性的值。 |
parallelEdge | 否 | parallelEdge Object | 重复边处理。 |
参数 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
action | 否 | String | 处理方式,取值为allow,ignore和override,默认为allow。
|
ignoreLabel | 否 | Boolean | 重复边的定义,是否忽略Label。取值为true或者false,默认取true。
|
targetProperties | 否 | Array | 判断重复边所用的属性列表。若不为空,则会将ignoreLabel做false处理,用于包含targetProperties指定列表中属性的边的重复边定义。 (仅action取override时考虑此参数)。 说明:
|
响应参数
参数 | 类型 | 说明 |
|---|---|---|
errorMessage | String | 参数解释: 系统提示信息。
取值范围: 不涉及。 |
errorCode | String | 参数解释: 系统提示信息。
取值范围: 不涉及。 |
result | String | 响应结果。成功时result值为success。 |
data | Object | 查询结果。查询成功时显示结果,若查询失败时,字段为空。 |
请求示例
添加边,source点名称为Lily,target点名称为Rocky,边的标签名为rate。
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges
{
"source": "Lily",
"target": "Rocky",
"label": "rate",
"properties": {
"Score": [
5
],
"Datetime": [
"2018-01-01 20:30:05"
]
},
"parallelEdge": {
"action": "override",
"ignoreLabel": true,
"targetProperties": [
{
"label": "rate",
"properties": [
"Datetime"
]
},
{
"label": "superclassOf",
"properties": [
"popularity"
]
}
]
}
} 
SERVER_URL:图的访问地址,取值请参考业务面API使用限制。
响应示例
状态码: 200
成功响应示例
Http Status Code: 200
{
"result":"success",
"data":{"index":"0"}
} 状态码: 400
Http Status Code: 400
{
"errorMessage":"Edge source vertex [Lily] does not exist",
"errorCode":"GES.8000"
} 状态码
返回值 | 说明 |
|---|---|
202 Accepted | 请求已接收,暂未处理。 |
400 Bad Request | 请求错误。 |
401 Unauthorized | 鉴权失败。 |
403 Forbidden | 没有操作权限。 |
404 Not Found | 找不到资源。 |
500 Internal Server Error | 服务内部错误。 |
503 Service Unavailable | 服务不可用。 |
错误码
请参见错误码。

