Adding an Edge
Function
This API is used to add an edge.
URI
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
graph_name |
Yes |
String |
Graph name |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
source |
Yes |
String |
Source vertex name |
target |
Yes |
String |
Target vertex name |
label |
No |
String |
Label of an edge. If no label exists, set it to __DEFAULT__. |
properties |
No |
Object |
Value of each property |
parallelEdge |
No |
parallelEdge Object |
How to process repetitive edges |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
action |
No |
String |
Processing mode of repetitive edges. The value can be allow, ignore, or override. The default value is allow.
|
ignoreLabel |
No |
Boolean |
Whether to ignore labels on repetitive edges. The value is true or false, and the default value is true.
|
targetProperties |
No |
Array |
List of properties used to determine repetitive edges. If this parameter is specified, ignoreLabel is set to false to define repetitive edges that contain properties in the list specified by this parameter. (This parameter is mandatory only when action is set to override.)
NOTE:
|
Parameter |
Mandatory |
Type |
Description |
label |
Yes |
String |
Labels whose repetitive edges need to be determined by property |
properties |
Yes |
Array |
List of properties whose repetitive edges need to be determined by property. Currently, only one property is supported. If multiple properties are entered, the first property is used. |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
errorMessage |
String |
System prompt.
|
errorCode |
String |
System prompt code.
|
result |
String |
Request result. If the request is successful, the value is success. If the request fails, the value is failed. |
data |
Object |
Query results. If the query is successful, the query results are returned. If the query fails, this parameter is left blank. |
Example Request
Add an edge. The source name is Lily, the target name is Rocky, and the label name of the edge is rate.
POST /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: Address for accessing a graph. For details about its value, see Using Service Plane APIs.
Example Response
Status code: 200
Example response for a successful request
Http Status Code: 200 { "result":"success", "data":{"index":"0"} }
Status code: 400
Http Status Code: 400 { "errorMessage":"edge source vertex [Lily] does not exist", "errorCode":"GES.8000" }
Status Code
Return Value |
Description |
---|---|
400 Bad Request |
Request error. |
401 Unauthorized |
Authorization failed. |
403 Forbidden |
No operation permissions. |
404 Not Found |
No resources found. |
500 Internal Server Error |
Internal server error. |
503 Service Unavailable |
Service unavailable. |
Error Code
See Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.