Help Center/ Graph Engine Service/ API Reference/ Service Plane APIs/ Memory Edition/ Updating Specified Properties of Vertices and Edges by Importing a File (2.2.13)
Updated on 2025-08-22 GMT+08:00

Updating Specified Properties of Vertices and Edges by Importing a File (2.2.13)

Function

This API is used to update specified properties of vertices and edges by importing a file.

To prevent failures in restoring the updated graph data during system restarting, do not delete the data stored on OBS when the graph is in use.

URI

POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-properties
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

graph_name

Yes

String

Graph name.

Request Parameters

The format of the CSV file for updating properties is as follows:

  • Vertex file (including label): vertex ID,label,property_1...property_n
  • Vertex file (excluding label): vertex ID,property_1...property_n
  • Edge file: source vertex ID, target vertex ID, label, edge ID, property_1...property_n
Table 2 Request body parameters

Parameter

Mandatory

Type

Description

vertexsetPath

At least one of the parameters vertexsetPath and edgesetPath is mandatory.

String

Vertex file directory or name.

vertexsetFormat

No

String

Vertex dataset format. Currently, the options are csv and txt.

The default value is csv.

vertexProperties

Mandatory if vertexsetPath exists

Object

Label of a vertex and list of properties to be updated in a vertex file, in JSONArray format. For details, see Table 3.

edgesetPath

At least one of the parameters vertexsetPath and edgesetPath is mandatory.

String

Edge file directory or name.

edgesetFormat

No

String

Edge dataset format. Currently, the options are csv and txt.

The default value is csv.

edgeProperties

Mandatory if edgesetPath is set.

Object

Label of an edge and list of properties to be updated in an edge file, in JSONArray format For details, see Table 4.

targetProperties

Mandatory if edgesetPath is set.

Object

Property information used to distinguish duplicate edges in the edge file, in JSONArray format. For details, see Table 5.

delimiter

No

Character

Field separator in a CSV file. The default value is comma (,). The default element separator in a field of the list/set type is semicolon (;).

trimQuote

No

Character

Field quote character in a CSV file. The default value is double quotation marks ("). They are used to enclose a field if the field contains separators or line breaks.

obsParameters

Yes

String

OBS authentication parameters. For details, see Table 6.

vertexFileContainLabel

No

Boolean

Whether the vertex file contains label information. This parameter is optional. The default value is true.

Table 3 vertexProperties parameter descriptions

Parameter

Mandatory

Type

Description

label

Yes

String

Label name.

properties

Yes

Object

Properties to be updated, in JSONArray format. The sequence of the properties must be the same as that in the vertex file.

Table 4 edgeProperties parameter descriptions

Parameter

Mandatory

Type

Description

label

Yes

String

Label name.

properties

Yes

Object

Properties to be updated, in JSONArray format. The sequence of the properties must be the same as that in the edge file.

Table 5 targetProperties parameter descriptions

Parameter

Mandatory

Type

Description

label

Yes

String

Label name.

properties

Yes

Object

Edge ID properties, in JSONArray format. Currently, only one property is supported.

Table 6 obsParameters parameter descriptions

Parameter

Mandatory

Type

Description

accessKey

Yes

String

Access key ID.

secretKey

Yes

String

Secret access key.

Response Parameters

Table 7 Response body parameters

Parameter

Type

Description

errorMessage

String

System prompt.

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

errorCode

String

System prompt.

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

jobId

String

ID of an asynchronous job.

NOTE:

You can check the job execution status and obtain the return result by querying the job ID. For details, see Job Management APIs.

jobType

Integer

Job type. This parameter is left blank if the request fails.

Example Request

Import a file to update specified properties of vertices and edges. The vertex file directory is datasets/movie/movie.csv, and the vertex dataset format is CSV. The edge file directory is datasets/movie/ranking_edge.csv, and the edge dataset format is also CSV.

POST http://{Endpoint}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-properties
{
  "vertexsetPath": "datasets/movie/movie.csv",
  "vertexsetFormat": "csv",
  "vertexProperties": [
    {
      "label": "movie",
      "properties": [
        "genres"
      ]
    }
  ],  
  "edgesetPath": "datasets/movie/ranking_edge.csv",
  "edgesetFormat": "csv",
  "edgeProperties": [
    {
      "label": "rate",
      "properties": [
        "Datetime"
      ]
    }
  ],
  "targetProperties": [
    {
      "label": "rate",
      "properties": [
        "Rating"
      ]
    }
  ],
  "delimiter": ",",
  "trimQuote": "\"",
  "obsParameters": {
	"accessKey": "XXXXXXX",
	"secretKey": "XXXXXXX"
  },
  "vertexFileContainLabel":  true
}

Example Response

Status code: 200

Example response for a successful request
Http Status Code: 200
{
    "jobId": "72b268f7-fdb6-467d-a41f-b1a09f26e593000003836",
    "jobType": 3
}

Status code: 400

Example response for a failed request

Http Status Code: 400
{
    "errorMessage": "Not found. Please check the input parameters.",
    "errorCode": "GES.8000"
}

Status Codes

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 Codes

See Error Codes.