Updated on 2023-08-04 GMT+08:00

Updating Edge Properties (1.1.6)

Function

This API is used to update edge property values. The operations include ADD, UPDATE, and DEL.

URI

POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?action_id={actionId}&source={sourceVertex}&target={targetVertex}&index={index}

Table 1 URI parameters

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

actionId

Yes

String

Operator. Possible values:

  • update: Update a property value.
  • add: Add a property value. When the property's cardinality is single, the operation is the same as that of UPDATE. When cardinality is list or set, the operator adds a value to a set.
  • del: Delete a property value.

sourceVertex

Yes

String

Source vertex of an edge

targetVertex

Yes

String

Target vertex of an edge

index

No

Integer

Edge index. If this parameter is not set, properties of the first edge between the vertices will be modified.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

properties

Yes

Object

Value of each property

targetProperties

No

Array

Properties used to determine duplicate edges.

  • If this parameter is not left blank, other properties of duplicate edges (with the same source vertex and target vertex) that has the same property value as the input property value will be overwritten. If there are multiple specified properties, the properties of the first edge that is matched based on the property input sequence are modified.
  • If this parameter is left blank or no property is specified for the input edge, the first edge that meets the criteria is updated.

For details about the property elements, see Table 3.

Table 3 targetProperty parameter description

Parameter

Mandatory

Type

Description

label

Yes

String

Label name. The label of duplicate edges is determined by the property.

properties

Yes

Array

Value of each property. The property list of duplicate edges is determined by the property. Currently, only a single property is supported. If multiple properties are entered, the first property is used.

Example Request

Update the property value of an edge. The value of property Rating is 7, the value of property Datetime is 2020-12-27 23:44:41, and the label name is rate.

POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?action_id=update&source=Lily&target=Tom&index=1
{
    "properties": {
        "Rating": ["7"],
        "Datetime":["2020-12-27 23:44:41"]
    },
    "targetProperties": [
    {
      "label": "rate",
      "properties": [
        "Rating"
      ]
    }
  ]
}

SERVER_URL: Address for accessing a graph. For details about its value, see Using Service Plane APIs.

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

errorMessage

String

System prompt.

  • If execution succeeds, this parameter may be left blank.
  • If execution fails, this parameter is used to display the error message.

errorCode

String

System prompt code.

  • If execution succeeds, this parameter may be left blank.
  • If execution fails, this parameter is used to display the error code.

result

String

Request result. If the request is successful, the value is success. If the request fails, the value is failed.

Example Response

Status code: 200

Example response for a successful request

Http Status Code: 200
 {
  "result": "success"
 }

Status code: 400

Example response for a failed request
Http Status Code: 400
 {
  "errorMessage": "edge [Lily-Tom-1] does not exist",
  "errorCode": "GES.8221"
 }

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.