Updated on 2025-08-22 GMT+08:00

Batch Adding Vertices (2.1.16)

Function

This API is used to add vertices in batches.

URI

POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-add
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

Request Parameters

Table 2 Request body parameter descriptions

Parameter

Mandatory

Type

Description

vertices

Yes

List

Vertices to add. You can add a maximum of 10,000 vertices at a time. For details about this array, see Table 3.

overrideExists

No

Boolean

Whether to overwrite the existing vertices in the vertices parameter. The default value is false.

  • If this parameter is set to false, existing vertices are ignored.
  • If this parameter is set to true, the existing vertices in the vertices parameter are overwritten.
Table 3 vertices parameter descriptions

Parameter

Mandatory

Type

Description

vertex

Yes

String

Vertex ID

label

Yes

String

Vertex label

properties

No

Json

Value of each property

Response Parameters

Table 4 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.

result

String

Response result. The value is success if the query is successful; this parameter is not returned if the query fails.

Example Request

Add vertices in batches. The names of the vertices to add are 150 and 6.

POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-add
{
    "vertices": [
        {
            "vertex": "150",
            "label": "movie",
            "properties": {
                "movieid": [
                    "150"
                ],
                "title": [
                    "testmoive"
                ],
                "genres": [
                    "Comedy"
                ]
            }
        },
        {
            "vertex": "6",
            "label": "movie",
            "properties": {
                "movieid": [
                    "6"
                ],
                "title": [
                    "testmoive_exist_id"
                ],
                "genres": [
                    "Comedy"
                ]
            }
        }
    ],
    "overrideExists": true
}
  • SERVER_URL: Address for accessing a graph. For details about its value, see Using Service Plane APIs.
  • In the example, if vertex 6 already exists in the graph, properties of vertex 6 are overwritten.

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": "Bad Request, parameter vertices cannot be null",
    "errorCode": "GES.8214"
}

Status Codes

Return Value

Description

202 Accepted

The request has been received but has not been processed.

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.