
# 添加边(1.0.6)
#### 功能介绍
添加边。
#### URI
- URI格式
  ```
  POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges
  ```
  

- 参数说明
  表1URI参数说明 
  | 参数         | 是否必选 | 类型     | 说明                                                                              |
  |:---|:---|:---|:---|
  | project_id | 是    | String | 项目ID。获取方法请参见[获取项目ID](https://support.huaweicloud.com/api-ges/ges_03_0111.html)。 |
  | graph_name | 是    | String | 图名称。                                                                            |
     
  
 
#### 请求
- 请求样例
  ```
  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": "override"
  }
  ```
  ![](https://support.huaweicloud.com/api-ges/public_sys-resources/note_3.0-zh-cn.png)
  SERVER_URL：图的访问地址，取值请参考[业务面API使用限制](https://support.huaweicloud.com/api-ges/ges_03_0139.html)。
  
- Body参数说明
  
  | 参数           | 是否必选 | 类型     | 说明                                                                                             |
  |:---|:---|:---|:---|
  | source       | 是    | String | source点名称。                                                                                     |
  | target       | 是    | String | target点名称。                                                                                     |
  | label        | 是    | String | 点的label，若没有则置为"__DEFAULT__"。                                                                   |
  | properties   | 否    | Json   | 各个属性的值。                                                                                        |
  | parallelEdge | 否    | String | 重复边的处理方式，可选值为allow，ignore和override。allow表示允许重复边；ignore表示忽略之后的重复边；override表示覆盖之前的重复边。默认值为allow。 |
     
  
 
#### 响应
- 要素说明
  
  | 参数           | 类型     | 说明                                  |
  |:---|:---|:---|
  | errorMessage | String | 系统提示信息，执行成功时，字段可能为空。执行失败时，用于显示错误信息。 |
  | errorCode    | String | 系统提示信息，执行成功时，字段可能为空。执行失败时，用于显示错误码。  |
  | data         | String | 查询成功时包含data字段，data字段中包含edges查询结果。   |
  | result       | String | 成功时result值为success。                 |
     
  
- 请求成功样例
  ```
  Http Status Code: 200
  {
   "result":"success",
   "data":{"index":"0"}
  }
  ```
  
- 请求失败样例
  ```
  Http Status Code: 400
  {
   "errorMessage":"Edge source vertex [Lily] does not exist",
   "errorCode":"GES.8000"
  }
  ```
  
 
#### 返回值
- 正常 200
  
- 异常
  表2异常返回值说明 
  | 返回值                       | 说明      |
  |:---|:---|
  | 400 Bad Request           | 请求错误。   |
  | 401 Unauthorized          | 鉴权失败。   |
  | 403 Forbidden             | 没有操作权限。 |
  | 404 Not Found             | 找不到资源。  |
  | 500 Internal Server Error | 服务内部错误。 |
  | 503 Service Unavailable   | 服务不可用。  |
     
  
 
