0% found this document useful (0 votes)
20 views731 pages

Ges Api

Uploaded by

Fakhr Al-Timimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views731 pages

Ges Api

Uploaded by

Fakhr Al-Timimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 731

Graph Engine Service(GES)

2.3.19

API Reference

Issue 01
Date 2024-04-30

HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.


Copyright © Huawei Cloud Computing Technologies Co., Ltd. 2024. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without prior
written consent of Huawei Cloud Computing Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are the property of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.

Notice
The purchased products, services and features are stipulated by the contract made between Huawei
Cloud and the customer. All or part of the products, services and features described in this document may
not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all
statements, information, and recommendations in this document are provided "AS IS" without
warranties, guarantees or representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.

Huawei Cloud Computing Technologies Co., Ltd.


Address: Huawei Cloud Data Center Jiaoxinggong Road
Qianzhong Avenue
Gui'an New District
Gui Zhou 550029
People's Republic of China

Website: https://www.huaweicloud.com/intl/en-us/

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. i


Graph Engine Service(GES)
API Reference Contents

Contents

1 Before You Start....................................................................................................................... 1


1.1 Overview.................................................................................................................................................................................... 1
1.2 API Calling..................................................................................................................................................................................1
1.3 Constraints and Limitations on Using GES..................................................................................................................... 1
1.3.1 Using Service Plane APIs................................................................................................................................................... 2
1.3.2 Naming OBS Objects.......................................................................................................................................................... 2
1.4 Concepts..................................................................................................................................................................................... 3
1.5 API Type or Version................................................................................................................................................................. 3

2 API Overview............................................................................................................................ 4
2.1 Management Plane APIs.......................................................................................................................................................4
2.2 Service Plane API..................................................................................................................................................................... 8
2.2.1 Memory Edition.................................................................................................................................................................... 8
2.2.2 Database Edition............................................................................................................................................................... 16

3 Calling APIs............................................................................................................................. 22
3.1 Making an API Request...................................................................................................................................................... 22
3.1.1 Making a Management Plane API Request..............................................................................................................22
3.1.2 Making a Service Plane API Request.......................................................................................................................... 25
3.2 Authentication....................................................................................................................................................................... 26
3.3 Response.................................................................................................................................................................................. 28

4 Management Plane APIs (V2)............................................................................................ 29


4.1 System Management........................................................................................................................................................... 29
4.1.1 Querying Quotas............................................................................................................................................................... 29
4.2 Graph Management............................................................................................................................................................. 32
4.2.1 Querying the Graph List.................................................................................................................................................. 32
4.2.2 Querying Graph Details................................................................................................................................................... 40
4.2.3 Creating a Graph............................................................................................................................................................... 47
4.2.4 Closing a Graph.................................................................................................................................................................. 55
4.2.5 Starting a Graph................................................................................................................................................................ 57
4.2.6 Deleting a Graph............................................................................................................................................................... 60
4.2.7 Incrementally Importing Data to a Graph................................................................................................................ 62
4.2.8 Exporting a Graph............................................................................................................................................................. 67
4.2.9 Clearing a Graph................................................................................................................................................................ 70

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. ii


Graph Engine Service(GES)
API Reference Contents

4.2.10 Upgrading a Graph......................................................................................................................................................... 73


4.2.11 Binding an EIP.................................................................................................................................................................. 76
4.2.12 Unbinding an EIP............................................................................................................................................................ 78
4.2.13 Resizing a Graph..............................................................................................................................................................81
4.2.14 Restarting a Graph......................................................................................................................................................... 83
4.2.15 Expanding a Graph......................................................................................................................................................... 86
4.3 Backup Management.......................................................................................................................................................... 89
4.3.1 Viewing the List of All Backups.................................................................................................................................... 89
4.3.2 Viewing the Backup List of a Graph........................................................................................................................... 93
4.3.3 Adding a Backup................................................................................................................................................................ 97
4.3.4 Deleting a Backup............................................................................................................................................................. 99
4.3.5 Exporting a Backup........................................................................................................................................................ 102
4.3.6 Importing a Backup........................................................................................................................................................ 104
4.4 Metadata Management................................................................................................................................................... 107
4.4.1 Constraints......................................................................................................................................................................... 107
4.4.2 Querying the Metadata List........................................................................................................................................ 109
4.4.3 Querying Metadata........................................................................................................................................................ 112
4.4.4 Adding Metadata............................................................................................................................................................ 116
4.4.5 Deleting Metadata..........................................................................................................................................................120
4.4.6 Importing Metadata from OBS.................................................................................................................................. 122
4.5 Task Center........................................................................................................................................................................... 124
4.5.1 Querying Job Status on the Management Plane................................................................................................. 124
4.5.2 Querying Job Details in the Job Center................................................................................................................... 129
4.6 Plugin Management.......................................................................................................................................................... 135
4.6.1 Querying Scene Analysis Plugin Information........................................................................................................ 135
4.6.2 Subscribing to a Scene Analysis Plugin................................................................................................................... 139
4.6.3 Unsubscribing from a Scene Analysis Plugin.........................................................................................................142

5 Service Plane APIs............................................................................................................... 146


5.1 Memory Edition...................................................................................................................................................................146
5.1.1 Vertex Operation APIs................................................................................................................................................... 146
5.1.1.1 Querying Vertices Based on Filter Criteria.......................................................................................................... 146
5.1.1.2 Querying Vertex Details............................................................................................................................................ 150
5.1.1.3 Adding a Vertex............................................................................................................................................................ 153
5.1.1.4 Deleting a Vertex......................................................................................................................................................... 155
5.1.1.5 Updating a Vertex Property..................................................................................................................................... 157
5.1.1.6 Querying Vertices in Batches................................................................................................................................... 160
5.1.1.7 Adding Vertices in Batches....................................................................................................................................... 163
5.1.1.8 Deleting Vertices in Batches.................................................................................................................................... 166
5.1.1.9 Updating Vertex Properties in Batches................................................................................................................ 168
5.1.1.10 Adding a Vertex Label............................................................................................................................................. 172
5.1.1.11 Deleting a Vertex Label........................................................................................................................................... 174
5.1.1.12 Exporting Filtered Vertices..................................................................................................................................... 176

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. iii
Graph Engine Service(GES)
API Reference Contents

5.1.1.13 Deleting Filtered Vertices....................................................................................................................................... 179


5.1.2 Edge Operation APIs...................................................................................................................................................... 182
5.1.2.1 Querying Edges Based on Filter Criteria.............................................................................................................. 182
5.1.2.2 Querying Edge Details............................................................................................................................................... 186
5.1.2.3 Adding an Edge............................................................................................................................................................ 189
5.1.2.4 Deleting an Edge......................................................................................................................................................... 193
5.1.2.5 Updating an Edge Property......................................................................................................................................196
5.1.2.6 Querying Edges in Batches....................................................................................................................................... 199
5.1.2.7 Adding Edges in Batches........................................................................................................................................... 202
5.1.2.8 Deleting Edges in Batches........................................................................................................................................ 208
5.1.2.9 Updating Edge Properties in Batches................................................................................................................... 212
5.1.2.10 Exporting Filtered Edges......................................................................................................................................... 215
5.1.2.11 Deleting Filtered Edges........................................................................................................................................... 218
5.1.3 Metadata Operation APIs.............................................................................................................................................220
5.1.3.1 Adding a Label..............................................................................................................................................................220
5.1.3.2 Updating a Label......................................................................................................................................................... 226
5.1.3.3 Querying Graph Metadata Details........................................................................................................................ 230
5.1.3.4 Deleting a Label........................................................................................................................................................... 234
5.1.3.5 Adding Labels in Batches.......................................................................................................................................... 236
5.1.3.6 Querying Schema Structure..................................................................................................................................... 240
5.1.3.7 Generating a Schema Structure..............................................................................................................................243
5.1.4 Index Operation APIs..................................................................................................................................................... 245
5.1.4.1 Creating an Index........................................................................................................................................................ 245
5.1.4.2 Deleting an Index........................................................................................................................................................ 249
5.1.4.3 Querying Indexes......................................................................................................................................................... 251
5.1.5 Gremlin Operation APIs................................................................................................................................................ 253
5.1.5.1 Executing a Gremlin Query...................................................................................................................................... 253
5.1.6 Algorithm APIs................................................................................................................................................................. 256
5.1.6.1 Executing an Algorithm............................................................................................................................................. 256
5.1.6.2 Algorithm API Parameter References................................................................................................................... 258
5.1.6.2.1 Common Algorithm Parameters......................................................................................................................... 258
5.1.6.2.2 PageRank.................................................................................................................................................................... 263
5.1.6.2.3 PersonalRank............................................................................................................................................................. 264
5.1.6.2.4 K-core........................................................................................................................................................................... 266
5.1.6.2.5 K-Hop........................................................................................................................................................................... 266
5.1.6.2.6 Common Neighbors................................................................................................................................................ 267
5.1.6.2.7 Common Neighbors of Vertex Sets....................................................................................................................268
5.1.6.2.8 Link Prediction........................................................................................................................................................... 270
5.1.6.2.9 Shortest Path............................................................................................................................................................. 270
5.1.6.2.10 All Shortest Paths.................................................................................................................................................. 272
5.1.6.2.11 Filtered Shortest Path........................................................................................................................................... 273
5.1.6.2.12 SSSP............................................................................................................................................................................ 276

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. iv


Graph Engine Service(GES)
API Reference Contents

5.1.6.2.13 Shortest Path of Vertex Set................................................................................................................................ 277


5.1.6.2.14 n-Paths...................................................................................................................................................................... 278
5.1.6.2.15 Filtered n-Paths...................................................................................................................................................... 279
5.1.6.2.16 Filtered All Pairs Shortest Paths........................................................................................................................282
5.1.6.2.17 All Shortest Paths of Vertex Sets...................................................................................................................... 284
5.1.6.2.18 Filtered All Shortest Paths.................................................................................................................................. 285
5.1.6.2.19 Connected Component........................................................................................................................................ 287
5.1.6.2.20 Label Propagation................................................................................................................................................. 288
5.1.6.2.21 Louvain...................................................................................................................................................................... 289
5.1.6.2.22 Node2vec.................................................................................................................................................................. 290
5.1.6.2.23 Real-time Recommendation.............................................................................................................................. 291
5.1.6.2.24 Degree Correlation................................................................................................................................................ 293
5.1.6.2.25 Triangle Count........................................................................................................................................................ 294
5.1.6.2.26 Cluster Coefficient................................................................................................................................................. 294
5.1.6.2.27 Closeness Centrality.............................................................................................................................................. 295
5.1.6.2.28 Filtered Circle Detection...................................................................................................................................... 295
5.1.6.2.29 Subgraph Matching...............................................................................................................................................298
5.1.6.2.30 Topicrank.................................................................................................................................................................. 300
5.1.7 Temporal Graph APIs..................................................................................................................................................... 301
5.1.7.1 Community Evolution (temporal_graph)............................................................................................................ 301
5.1.7.2 Temporal BFS (temporal_bfs).................................................................................................................................. 304
5.1.7.3 Temporal Paths............................................................................................................................................................. 308
5.1.8 Path APIs............................................................................................................................................................................ 311
5.1.8.1 Querying Path Details................................................................................................................................................ 311
5.1.8.2 Querying Tree Details.................................................................................................................................................315
5.1.8.3 Repeat-query API......................................................................................................................................................... 319
5.1.9 Graph Statistics APIs...................................................................................................................................................... 326
5.1.9.1 Querying General Information About a Graph................................................................................................. 326
5.1.9.2 Querying the Graph Version.................................................................................................................................... 330
5.1.10 Graph Operation APIs................................................................................................................................................. 332
5.1.10.1 Importing a Graph.................................................................................................................................................... 332
5.1.10.2 Exporting a Graph..................................................................................................................................................... 336
5.1.10.3 Clearing a Graph....................................................................................................................................................... 338
5.1.11 Subgraph Operation APIs...........................................................................................................................................340
5.1.11.1 Querying a Subgraph............................................................................................................................................... 341
5.1.11.2 Executing an Algorithm on a Subgraph............................................................................................................ 344
5.1.12 Job Management APIs................................................................................................................................................ 347
5.1.12.1 Querying Job Status on the Service Plane........................................................................................................ 347
5.1.12.2 Canceling a Job.......................................................................................................................................................... 350
5.1.12.3 Exporting Job Execution Results to Files........................................................................................................... 352
5.1.12.4 Querying the Job List............................................................................................................................................... 358
5.1.13 Custom Operations APIs............................................................................................................................................ 361

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. v


Graph Engine Service(GES)
API Reference Contents

5.1.13.1 Performing Custom Operations........................................................................................................................... 361


5.1.14 Cypher Operation APIs................................................................................................................................................364
5.1.14.1 Executing Cypher Queries...................................................................................................................................... 364
5.1.14.2 Cypher Prerequisites................................................................................................................................................. 370
5.1.14.3 Basic Operations and Compatibility................................................................................................................... 370
5.1.14.4 Supported Expressions, Functions, and Procedures....................................................................................... 375
5.1.15 Filtered-query API......................................................................................................................................................... 385
5.1.16 Filtered-query V2.......................................................................................................................................................... 397
5.1.17 Domain-Specific Language (DSL) Query APIs....................................................................................................407
5.1.17.1 Executing the DSL Algorithm................................................................................................................................ 407
5.1.17.2 DSL Syntax................................................................................................................................................................... 410
5.1.18 Updating Specified Properties of Vertices and Edges by Importing a File............................................... 423
5.1.19 Deleting Vertices and Edges by Reading Files.................................................................................................... 427
5.1.20 Intelligent Q&A API (HDFS Scenario)....................................................................................................................431
5.2 Database Edition................................................................................................................................................................ 436
5.2.1 Specification Description.............................................................................................................................................. 436
5.2.2 Vertex Operation APIs................................................................................................................................................... 437
5.2.2.1 Querying Vertex Details............................................................................................................................................ 437
5.2.2.2 Querying Vertices in Batches................................................................................................................................... 440
5.2.2.3 Adding Vertices in Batches....................................................................................................................................... 443
5.2.2.4 Deleting Vertices in Batches.................................................................................................................................... 446
5.2.2.5 Updating Vertex Properties in Batches................................................................................................................ 448
5.2.3 Edge Operation APIs...................................................................................................................................................... 452
5.2.3.1 Querying Edge Details............................................................................................................................................... 452
5.2.3.2 Querying Edges in Batches....................................................................................................................................... 455
5.2.3.3 Adding Edges in Batches........................................................................................................................................... 458
5.2.3.4 Deleting Edges in Batches........................................................................................................................................ 461
5.2.3.5 Updating Edge Properties in Batches................................................................................................................... 464
5.2.4 Metadata Operation APIs.............................................................................................................................................467
5.2.4.1 Adding a Label..............................................................................................................................................................467
5.2.4.2 Updating a Label......................................................................................................................................................... 472
5.2.4.3 Querying Labels........................................................................................................................................................... 476
5.2.4.4 Querying Graph Metadata Details........................................................................................................................ 478
5.2.5 Index Operation APIs..................................................................................................................................................... 481
5.2.5.1 Creating an Index........................................................................................................................................................ 481
5.2.5.2 Deleting an Index........................................................................................................................................................ 485
5.2.5.3 Querying Indexes......................................................................................................................................................... 487
5.2.5.4 Creating Indexes in Batches..................................................................................................................................... 489
5.2.6 HyG Graph Management APIs................................................................................................................................... 493
5.2.6.1 Creating a HyG Graph................................................................................................................................................ 493
5.2.6.2 Synchronizing HyG Graph Data.............................................................................................................................. 496
5.2.6.3 Querying General Information About a HyG Graph....................................................................................... 499

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. vi


Graph Engine Service(GES)
API Reference Contents

5.2.6.4 Deleting a HyG Graph................................................................................................................................................502


5.2.6.5 Listing HyG Graphs..................................................................................................................................................... 504
5.2.7 HyG Algorithm APIs....................................................................................................................................................... 507
5.2.7.1 Running Algorithms.................................................................................................................................................... 507
5.2.7.2 Algorithm API Parameter Reference..................................................................................................................... 509
5.2.7.2.1 Common Algorithm Parameters......................................................................................................................... 509
5.2.7.2.2 Shortest Path............................................................................................................................................................. 510
5.2.7.2.3 SSSP.............................................................................................................................................................................. 513
5.2.7.2.4 K-Hop........................................................................................................................................................................... 516
5.2.7.2.5 PageRank.................................................................................................................................................................... 519
5.2.7.2.6 Connected Component...........................................................................................................................................522
5.2.7.2.7 K-core........................................................................................................................................................................... 524
5.2.8 HyG Job Management APIs......................................................................................................................................... 527
5.2.8.1 Dumping HyG Algorithm Results........................................................................................................................... 527
5.2.8.2 Canceling a HyG Job................................................................................................................................................... 530
5.2.9 Native Algorithm APIs................................................................................................................................................... 532
5.2.9.1 Executing an Algorithm............................................................................................................................................. 532
5.2.9.2 Algorithm API Parameter References................................................................................................................... 534
5.2.9.2.1 Common Algorithm Parameters......................................................................................................................... 534
5.2.9.2.2 Shortest Path............................................................................................................................................................. 536
5.2.9.2.3 Shortest Path of Vertex Set...................................................................................................................................538
5.2.9.2.4 Common Neighbors of Vertex Sets....................................................................................................................539
5.2.10 Graph Statistics APIs.................................................................................................................................................... 541
5.2.10.1 Querying General Information About a Graph............................................................................................... 541
5.2.10.2 Querying the Graph Version.................................................................................................................................. 543
5.2.11 Graph Operation APIs................................................................................................................................................. 545
5.2.11.1 Importing a Graph.................................................................................................................................................... 545
5.2.11.2 Clearing a Graph....................................................................................................................................................... 549
5.2.11.3 Exporting a Graph..................................................................................................................................................... 551
5.2.11.4 Creating a Graph....................................................................................................................................................... 555
5.2.11.5 Deleting a Graph....................................................................................................................................................... 557
5.2.11.6 Listing Graphs............................................................................................................................................................. 559
5.2.12 Job Management APIs................................................................................................................................................ 561
5.2.12.1 Querying the Job List............................................................................................................................................... 561
5.2.12.2 Querying Job Status................................................................................................................................................. 564
5.2.13 Cypher Operation APIs................................................................................................................................................567
5.2.13.1 Executing Cypher Queries...................................................................................................................................... 568
5.2.13.2 Basic Operations and Compatibility................................................................................................................... 574
5.2.13.3 Supported Expressions, Functions, and Procedures....................................................................................... 579

6 Application Examples.........................................................................................................589
6.1 Analyzing Graphs Using HyG API Algorithms.......................................................................................................... 589

7 Monitoring Metrics............................................................................................................. 592

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. vii
Graph Engine Service(GES)
API Reference Contents

8 Out-of-Date APIs................................................................................................................. 599


8.1 Management Plane APIs (V1)........................................................................................................................................599
8.1.1 System Management APIs........................................................................................................................................... 599
8.1.1.1 Querying Quotas......................................................................................................................................................... 599
8.1.2 Graph Management APIs............................................................................................................................................. 602
8.1.2.1 Querying the Graph List............................................................................................................................................ 602
8.1.2.2 Querying Graph Details............................................................................................................................................. 609
8.1.2.3 Creating a Graph..........................................................................................................................................................616
8.1.2.4 Closing a Graph............................................................................................................................................................ 624
8.1.2.5 Starting a Graph.......................................................................................................................................................... 627
8.1.2.6 Deleting a Graph......................................................................................................................................................... 629
8.1.2.7 Incrementally Importing Data to a Graph.......................................................................................................... 631
8.1.2.8 Exporting a Graph....................................................................................................................................................... 636
8.1.2.9 Clearing a Graph.......................................................................................................................................................... 639
8.1.2.10 Upgrading a Graph................................................................................................................................................... 641
8.1.2.11 Binding an EIP............................................................................................................................................................ 644
8.1.2.12 Unbinding an EIP....................................................................................................................................................... 647
8.1.2.13 Resizing a Graph........................................................................................................................................................ 649
8.1.2.14 Restarting a Graph....................................................................................................................................................652
8.1.2.15 Expanding a Graph................................................................................................................................................... 654
8.1.3 Backup Management APIs........................................................................................................................................... 657
8.1.3.1 Viewing the List of All Backups.............................................................................................................................. 657
8.1.3.2 Viewing the Backup List of a Graph......................................................................................................................661
8.1.3.3 Adding a Backup.......................................................................................................................................................... 665
8.1.3.4 Deleting a Backup....................................................................................................................................................... 667
8.1.4 Metadata Management APIs...................................................................................................................................... 669
8.1.4.1 Constraints..................................................................................................................................................................... 669
8.1.4.2 Querying the Metadata List..................................................................................................................................... 671
8.1.4.3 Querying Metadata.....................................................................................................................................................674
8.1.4.4 Adding Metadata......................................................................................................................................................... 677
8.1.4.5 Deleting Metadata...................................................................................................................................................... 681
8.1.4.6 Importing Metadata from OBS............................................................................................................................... 683
8.1.5 Task Center APIs.............................................................................................................................................................. 685
8.1.5.1 Querying Job Status on the Management Plane............................................................................................. 685
8.1.5.2 Querying Job Details in the Job Center............................................................................................................... 690

9 Appendix............................................................................................................................... 697
9.1 Status Codes......................................................................................................................................................................... 697
9.2 Error Codes........................................................................................................................................................................... 701
9.2.1 Error Codes for Management Plane APIs............................................................................................................... 701
9.2.2 Error Codes for Service Plane APIs............................................................................................................................ 708
9.3 Obtaining a Project ID...................................................................................................................................................... 717
9.4 Obtaining the Tenant ID.................................................................................................................................................. 718

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. viii
Graph Engine Service(GES)
API Reference Contents

9.5 Obtaining an Endpoint..................................................................................................................................................... 718

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. ix


Graph Engine Service(GES)
API Reference 1 Before You Start

1 Before You Start

1.1 Overview
Welcome to Graph Engine Service API Reference. Graph Engine Service (GES) is
the first commercial self-built distributed native graph engine with independent
intellectual property rights in the industry. It facilitates querying and analysis of
graph structure data based on relationships. It is specifically suited for scenarios
involving social applications, enterprise relationship analysis, risk control,
recommendations, public opinions, and anti-fraud.

This document describes how to use application programming interfaces (APIs) to


perform operations on GES resources.

● Management Plane APIs


Management plane APIs provide graph management functions, including
creating, stopping, starting, restoring, and upgrading graphs, importing,
exporting, and clearing data, creating, querying, and deleting graph backups,
and managing metadata. You need to call the management plane APIs to
perform these operations.
● Service Plane APIs
Service plane APIs provide graph service functions, including adding, deleting,
querying, and modifying vertices, edges, and metadata files, performing
Gremlin queries, and running algorithms. You need to call the service plane
APIs to perform these operations.

Before calling APIs of GES, ensure that you are familiar with GES concepts.

1.2 API Calling


GES supports Representational State Transfer (REST) APIs, allowing you to call
APIs using HTTPS. For details about API calling, see Making an API Request.

1.3 Constraints and Limitations on Using GES

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 1


Graph Engine Service(GES)
API Reference 1 Before You Start

1.3.1 Using Service Plane APIs


You can access the service plane APIs by anyone of the following methods:
● Through the ECS. The VPC for creating the ECS must be the same as that
selected during graph creation. If the same security group is selected, you can
directly access the APIs. If the security groups are not the same, enable the
access permission for the ECS in the security group where the graph is
created. That is, enable ports 80 and 443 for inbound traffic and all ports for
outbound traffic. The ingress and egress ports support HTTP and HTTPS
access respectively. In this scenario, SERVER_URL of the APIs is the private
access address in the graph details on the GES console or the value of the
privateIp field in the response body of the management plane API for
querying graph details.
● Through the ECS. The VPC for creating the ECS is not the same as that
selected during graph creation. You need to create a VPC peering connection
between the VPC to which the ECS belongs and the VPC in which the graph is
created. In addition, you need to enable the access permission for the ECS in
the security group where the graph is created. That is, enable ports 80 and
443 for inbound traffic and all ports for outbound traffic. In this scenario,
SERVER_URL of the APIs is the private access address in the graph details on
the GES console or the value of the privateIp field in the response body of
the management plane API for querying graph details.
● Through the public network. You need to create an EIP and enable the access
permission for the client in the security group where the graph is created, that
is, enable ports 80 and 443 for inbound traffic and all ports for outbound
traffic. In this scenario, SERVER_URL of the APIs is the public access address in
the graph details on the GES console or the value of the publicIp field in the
response body of the management plane API for querying graph details (also
the EIP you bind or create).

1.3.2 Naming OBS Objects


The OBS object names supported by GES can contain the following characters:

Letters and digits 0-9, a-z, A-Z

Special characters !-_.*'()

The following characters are not supported:

Special characters \{^}%`]">[~<#|&@:,$=+? and spaces

ASCII control Range:


characters ● 00–1F in hexadecimal form (0–31 in decimal form)
● 7F (127 in decimal form)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 2


Graph Engine Service(GES)
API Reference 1 Before You Start

1.4 Concepts
● User
A user is created on ManageOne Operation Portal to use cloud services. Each
user has its own identity credentials (password and access keys).
The account name, username, and password will be required for API
authentication.
● Region
Regions are geographic areas isolated from each other. Resources are region-
specific and cannot be used across regions through internal network
connections. For low network latency and quick resource access, select the
nearest region.
● AZ
An AZ comprises of one or more physical data centers equipped with
independent ventilation, fire, water, and electricity facilities. Computing,
network, storage, and other resources in an AZ are logically divided into
multiple clusters. AZs within a region are interconnected using high-speed
optical fibers to allow you to build cross-AZ high-availability systems.
● Project
Projects group and isolate resources (including compute, storage, and network
resources) across physical regions. A default project is provided for each cloud
region, and subprojects can be created under each default project. Users can
be granted permissions to access all resources in a specific project. For more
refined access control, create subprojects under a project and apply for
resources in the subprojects. Users can then be assigned permissions to access
only specific resources in the subprojects.

1.5 API Type or Version


The GES API version corresponds to the software version. 2.2.0 is the start version
number. Other versions are updated based on the start version and are backward
compatible.
You are advised to select a proper type as required.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 3


Graph Engine Service(GES)
API Reference 2 API Overview

2 API Overview

2.1 Management Plane APIs


GES management plane APIs comprise APIs for system management, graph
management, backup management, metadata management, task center, and
plugin management.

Table 2-1 System management APIs


Paramet URL Function
er

Queryin GET /v2/{project_id}/graphs/ Query the quota of graphs, edges,


g quotas or backups. When creating or
Quotas backing up a graph, you can call
this API to view the quota.

Table 2-2 Graph management APIs


Paramet URL Function
er

Queryin GET /v2/{project_id}/graphs Query the list of all created


g the graphs.
Graph
List

Queryin GET /v2/{project_id}/graphs/ Query details about a graph,


g Graph {graph_id} including the graph's private and
Details public access addresses, version
number, and imported vertex and
edge data sets.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 4


Graph Engine Service(GES)
API Reference 2 API Overview

Paramet URL Function


er

Creating POST /v2/{project_id}/graphs Create a graph after you define


a Graph the metadata and vertex and edge
data sets of the graph.

Stoppin POST /v2/{project_id}/graphs/ You can stop a graph at any time


ga {graph_id}/stop because service continuity is not
Graph required.

Starting POST /v2/{project_id}/graphs/ If you want to use a stopped


a Graph {graph_id}/start graph, you can restore the data to
the state it was before the
shutdown or to a backup time
point.

Deleting DELETE /v2/{project_id}/graphs/ Delete a graph when you do not


a Graph {graph_id} need it.

Increme POST /v2/{project_id}/graphs/ You need to incrementally import


ntally {graph_id}/import-graph graph data in batches.
Importin
g Data
to a
Graph

Exportin POST /v2/{project_id}/graphs/ You need to export all the data in


ga {graph_id}/export-graph a graph as a text file.
Graph

Clearing POST /v2/{project_id}/graphs/ You need to clear all the data in a


a Graph {graph_id}/clear-graph graph, including the vertex and
edge data.
NOTE
The metadata will not be cleared.

Upgradi POST /v2/{project_id}/graphs/ If bugs are detected in a graph of


ng a {graph_id}/upgrade the early version or new functions
Graph need to be added, you need to
upgrade the graph to the new
version.

Binding POST /v2/{project_id}/graphs/ To access a graph over the public


an EIP {graph_id}/bind-eip network, you need to bind an EIP.

Unbindi POST /v2/{project_id}/graphs/ You can unbind an EIP from a


ng an {graph_id}/unbind-eip graph if you no longer need to
EIP access the graph over the public
network.

Resizing POST /v2/{project_id}/graphs/ Resize a graph instance.


a Graph {graph_id}/resize

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 5


Graph Engine Service(GES)
API Reference 2 API Overview

Paramet URL Function


er

Forcibly POST /v2/{project_id}/graphs/ Forcibly start a graph.


Restarti {graph_id}/restart
ng a
Graph

Expandi POST /v2/{project_id}/graphs/ This API is used to expand


ng a {graph_id}/expand multiple secondary nodes
Graph dynamically. The expanded
secondary nodes can process read
requests, improving read
performance.

Table 2-3 Backup management APIs


Paramet URL Function
er

Viewing GET /v2/{project_id}/graphs/ View all backup details of all


the List backups graphs.
of All
Backups

Viewing GET /v2/{project_id}/graphs/ View details about all backups of


the {graph_id}/backups a graph, including the backup
Backup start time and end time.
List of a
Graph

Adding a POST /v2/{project_id}/graphs/ Backup is used to improve data


Backup {graph_id}/backups reliability. It can also be used as a
snapshot of a graph for you to
restore data when necessary.

Deleting DELETE /v2/{project_id}/graphs/ Delete backups of a graph.


a Backup {graph_id}/backups/{backup_id}

Exportin POST /v2/{project_id}/graphs/ Export a GES graph instance


ga {graph_id}/backups/export backup to OBS.
Backup

Importin POST /v2/{project_id}/graphs/ Import a GES graph instance


ga {graph_id}/backups/import backup from OBS.
Backup

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 6


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-4 Metadata management APIs


Paramete URL Function
r

Querying GET /v2/{project_id}/graphs/ Query details about all metadata


the metadatas files, including the status and
Metadat OBS storage path.
a List

Querying GET /v2/{project_id}/graphs/ Query details about a graph


Metadat metadatas/{metadata_id} metadata file.
a

Adding POST /v2/{project_id}/graphs/ Add metadata to prepare for


Metadat metadatas creating a graph.
a

Deleting DELETE /v2/{project_id}/graphs/ Delete a metadata file.


Metadat metadatas/{metadata_id}
a

Importin POST /v2/{project_id}/graphs/ Import metadata from OBS.


g metadata/upload-from-obs
Metadat
a from
OBS

Table 2-5 Task center APIs


Paramete URL Function
r

Querying GET /v2/{project_id}/graphs/ Graph deleting, stopping,


the Job {graph_id}/jobs/{job_id}/status starting, restoring, incrementally
Status importing, clearing, and
upgrading are asynchronous jobs
initialized by calling these APIs.
These APIs return the job IDs. You
can view the execution status of
each asynchronous job through
the corresponding API.

Querying GET /v2/{project_id}/graphs/ View all asynchronous jobs.


Job jobs
Details in
the Job
Center

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 7


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-6 Plugin management APIs

API URL Function

Querying GET /v2/{project_id}/graphs/ Query information about the


Scene scenes application analysis capability in
Analysis a scene, including information
Plugin about the applications,
Informati parameters, and function details.
on

Subscribi POST /v2/{project_id}/graphs/ This API is used to subscribe to a


ng to a {graph_id}/scenes/register scene analysis plugin so that you
Scene can use the function through the
Analysis service plane APIs.
Plugin

Unsubscr POST /v2/{project_id}/graphs/ This API is used to unsubscribe


ibing {graph_id}/scenes/unregister from a scene analysis plugin.
from a After the subscription is canceled,
Scene you cannot use the function
Analysis through application service plane
Plugin APIs.

2.2 Service Plane API

2.2.1 Memory Edition


Memory edition service plane APIs cover vertex operations, edge operations,
metadata operations, index operations, Gremlin operations, algorithms, paths,
graph statistics, graph and subgraph operations, job management, and Cypher
operations.

Table 2-7 Vertex operation APIs

API URL Function

Querying POST/ges/v1.0/{project_id}/ Query vertices based on a


Vertices graphs/{graph_name}/vertices/ filtering criterion. For example,
That action?action_id=query if the vertex metadata contains
Meet the age property, the filter
Filter criterion can be 'age > 18'.
Criteria

Querying GET/ges/v1.0/{project_id}/ Query details about a specified


Vertex graphs/{graph_name}/vertices/ vertex of a specified set of
Details detail?vertexIds={vertex_ids} vertices, including the label
information.

Adding a POST /ges/v1.0/{project_id}/ Add a vertex.


Vertex graphs/{graph_name}/vertices

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 8


Graph Engine Service(GES)
API Reference 2 API Overview

API URL Function

Deleting DELETE/ges/v1.0/{project_id}/ Delete a vertex.


a Vertex graphs/{graph_name}/vertices/
{vertex_id}

Updating POST/ges/v1.0/{project_id}/ Modify a vertex's properties,


Vertex graphs/{graph_name}/vertices/ including adding, changing,
Propertie {vertex_id}/properties/action? and deleting properties.
s action_id={actionId}

Querying POST/ges/v1.0/{project_id}/ Query vertex details in batches.


Vertex graphs/{graph_name}/vertices/
Data in action?action_id=batch-query
Batches

Adding POST /ges/v1.0/{project_id}/ Add vertices in batches.


Vertices graphs/{graph_name}/vertices/
in action?action_id=batch-add
Batches

Deleting POST /ges/v1.0/{project_id}/ Delete vertices in batches


Vertices graphs/{graph_name}/vertices/ based on the vertex IDs.
in action?action_id=batch-delete
Batches

Updating POST /ges/v1.0/{project_id}/ Update vertex properties in


Vertex graphs/{graph_name}/vertices/ batches.
Propertie properties/action?
s in action_id={actionId}
Batches

Adding a POST /ges/v1.0/{project_id}/ Add a vertex label.


Vertex graphs/{graph_name}/vertices/
Label {vertex_id}/labels

Deleting DELETE /ges/v1.0/{project_id}/ Delete a vertex label.


a Vertex graphs/{graph_name}/vertices/
Label {vertex_id}/labels/{label_name}

Exporting POST /ges/v1.0/{project_id}/ Export the vertex set that


Filtered graphs/{graph_name}/vertices/ meets the filter criteria.
Vertices action?action_id=export

Deleting POST /ges/v1.0/{project_id}/ Delete the vertex set that


Filtered graphs/{graph_name}/vertices/ meets the filter criteria.
Vertices action?action_id=delete

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 9


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-8 Edge operation APIs


API URL Function

Querying POST/ges/v1.0/{project_id}/ Filter the edges that meet the


Vertices graphs/{graph_name}/edges/ filter criteria of edge
That action?action_id=query properties.
Meet
Filter
Criteria

Querying GET /ges/v1.0/{project_id}/ Query the details about an


Edge graphs/{graph_name}/edges/ edge based on its source and
Details detail? target vertices, including the
source={sourceVertex}&target={t edge's label information.
argetVertex}&index={index}

Adding POST /ges/v1.0/{project_id}/ Add an edge.


an Edge graphs/{graph_name}/edges

Deleting DELETE /ges/v1.0/{project_id}/ Delete an edge.


an Edge graphs/{graph_name}/edges?
source={sourceVertex}&target={t
argetVertex}&index={index}
Updating POST/ges/v1.0/{project_id}/ Modify an edge's properties,
Edge graphs/{graph_name}/edges/ including adding, changing,
Properties properties/action? and deleting properties.
action_id={actionId}&source={sou
rceVertex}&target={targetVertex
}&index={index}

Querying POST/ges/v1.0/{project_id}/ Query edge details in batches.


Edge graphs/{graph_name}/edges/
Data in action?action_id=batch-query
Batches

Adding POST /ges/v1.0/{project_id}/ Add edges in batches.


Edges in graphs/{graph_name}/edges/
Batches action?action_id=batch-add

Deleting POST /ges/v1.0/{project_id}/ Delete edges in batches based


Edges in graphs/{graph_name}/edges/ on the source vertices, target
Batches action?action_id=batch-delete vertices, and indexes of the
edges.

Updating POST /ges/v1.0/{project_id}/ Update edge properties in


Edge graphs/{graph_name}/edges/ batches.
Properties properties/action?
in action_id={actionId}
Batches

Exporting POST /ges/v1.0/{project_id}/ Export the edge set that meets


Filtered graphs/{graph_name}/edges/ the filter criteria.
Edges action?action_id=export

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 10


Graph Engine Service(GES)
API Reference 2 API Overview

API URL Function

Deleting POST /ges/v1.0/{project_id}/ Delete the edge set that meets


Filtered graphs/{graph_name}/edges/ the filter criteria.
Edges action?action_id=delete

Table 2-9 Metadata operation APIs


API URL Function

Adding a POST /ges/v1.0/{project_id}/ Add a label.


Label graphs/{graph_name}/schema/
labels

Updating POST /ges/v1.0/{project_id}/ Update a label.


a Label graphs/{graph_name}/schema/
labels/{label_name}/properties

Querying GET /ges/v1.0/{project_id}/ Query metadata details.


Graph graphs/{graph_name}/schema
Metadata
Details

Deleting DELETE /ges/v1.0/{project_id}/ Delete a label as well as the


a Label graphs/{graph_name}/schema/ vertices and edges associated
labels/{labelName} with the label.

Querying GET /ges/v1.0/{project_id}/ Query a generated schema


a Schema graphs/{graph_name}/schema/ (obtained from OBS).
structure?detail={details}

Generatin POST /ges/v1.0/{project_id}/ Generate a schema where


ga graphs/{graph_name}/schema/ labels are represented with
Schema structure/build vertices and the relationship
between the labels are
represented with edges, and
store the schema in an OBS
bucket.

Table 2-10 Index operation APIs


API URL Function

Creating POST /ges/v1.0/{project_id}/ Create an index.


an Index graphs/{graph_name}/indices

Deleting DELETE /ges/v1.0/{project_id}/ Delete an index.


an Index graphs/{graph_name}/indices/
{indexName}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 11


Graph Engine Service(GES)
API Reference 2 API Overview

API URL Function

Querying GET /ges/v1.0/{project_id}/graphs/ Query indexes.


Indexes {graph_name}/indices

Table 2-11 Gremlin operation APIs

API URL Function

Executing POST /ges/v1.0/{project_id}/ Execute Gremlin queries.


Gremlin graphs/{graph_name}/action?
Queries action_id=execute-gremlin-query

Table 2-12 Algorithm APIs

Operatio URL Function


n

Runing POST /ges/v1.0/{project_id}/ Run algorithms.


Algorith graphs/{graph_name}/action?
ms action_id=execute-algorithm

Table 2-13 Temporal graph APIs

API URL Function

Commun POST /ges/v1.0/{project_id}/ The community evolution


ity graphs/{graph_name}/ algorithm generates a
Evolution dynamicgraphs/action? temporal graph that shows
(tempora action_id=execute-analysis structure changes of a
l_graph) community over time.

Temporal POST /ges/v1.0/{project_id}/ This algorithm searches for


BFS graphs/{graph_name}/ associated vertices based on
(tempora dynamicgraphs/action? temporal message passing
l_bfs) action_id=execute-analysis and temporal BFS algorithms,
and outputs the visit time of
each vertex and the distance
from the vertex to the source
start vertex.

Temporal POST /ges/v1.0/{project_id}/ Execute the temporal paths


Paths graphs/{graph_name}/ algorithm based on input
dynamicgraphs/action? parameters. Only one
action_id=execute-analysis temporal path that meets the
conditions is returned
between two vertices.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 12


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-14 Path APIs

Paramete URL Function


r

Querying POST /ges/v1.0/{project_id}/graphs/ Query the path details.


Path {graph_name}/paths/action?
Details action_id=query-detail

Querying POST /ges/v1.0/{project_id}/graphs/ After you input a vertex, a


Tree {graph_name}/action? tree starting from the vertex
Details action_id=query-tree is output, including nodes
and edges in the tree, and
information about reachable
paths. Parameters can be the
direction (out, in, and out
and in), maximum number of
hops, and edge properties to
be filtered.

Repeat- POST /ges/v1.0/{project_id}/graphs/ Cyclically perform traversal


query API {graph_name}/action? query based on certain exit
action_id=repeat-query conditions.

Table 2-15 Graph statistics APIs

Operatio URL Function


n

Querying GET /ges/v1.0/{project_id}/graphs/ Query general information


General {graph_name}/summary about a graph.
Informati
on About
a Graph

Querying GET /ges/v1.0/{project_id}/graphs/ Query the graph version.


the Graph {graph_name}/version
Version

Table 2-16 Graph operation APIs

Operatio URL Function


n

Importing POST /ges/v1.0/{project_id}/graphs/ Import data.


a Graph {graph_name}/action?action_id=
import-graph

Exporting POST /ges/v1.0/{project_id}/graphs/ Export data.


a Graph {graph_name}/action?
action_id=export-graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 13


Graph Engine Service(GES)
API Reference 2 API Overview

Operatio URL Function


n

Clearing POST /ges/v1.0/{project_id}/graphs/ Clear data.


a Graph {graph_name}/action?
action_id=clear-graph

Table 2-17 Subgraph operation APIs


Operatio URL Function
n

Querying POST/ges/v1.0/{project_id}/graphs/ Query the subgraphs that are


a {graph_name}/subgraphs/action? created by the specified
Subgraph action_id=query vertices and the edges
connecting them.

Executing POST /ges/v1.0/{project_id}/graphs/ Adjust the subgraph creation


an {graph_name}/subgraphs/action? type based on the input and
Algorith action_id=execute-algorithm execute an algorithm on the
m on a generated subgraph.
Subgraph

Table 2-18 Job management APIs


Operatio URL Function
n

Querying GET/ges/v1.0/{project_id}/graphs/ Query job status.


Task {graph_name}/jobs/{job_id}/status?
Status offset=offset&limit=limit

Canceling DELETE https://Endpoint/ges/v1.0/ Cancel a job.


a Job {project_id}/graphs/{graph_name}/
jobs/{job_id}

Exporting POST /ges/v1.0/{project_id}/graphs/ Export the execution result


Job {graph_name}/jobs/{job_id}/action? (result) of an asynchronous
Execution action_id=export-result job (job_id) to a file.
Results to
Files

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 14


Graph Engine Service(GES)
API Reference 2 API Overview

Operatio URL Function


n

Querying GET /ges/v1.0/{project_id}/graphs/ After the ID of an


the Job {graph_name}/jobs/status? asynchronous job is returned,
List limit={limit}&offset={offset} if the job ID at the service
layer is lost and cannot be
obtained through the API, a
new API is provided to query
all asynchronous jobs stored
in the engine. The job ID, job
status, and original request
of each job are returned.

Table 2-19 Custom operations APIs


API URL Function

Performi POST /ges/v1.0/{project_id}/graphs/ Query the job status.


ng {graph_name}/action?
Custom action_id=execute-operation
Operatio
ns

Table 2-20 Other service plane APIs


Operation URL Function

Cypher POST /ges/v1.0/{project_id}/graphs/ Run Cypher statements to


Operation {graph_name}/action? query data in GES and
APIs action_id=execute-cypher-query obtain results.

Filtered- POST /ges/v1.0/{project_id}/graphs/ Filter the k-hop process layer


query API {graph_name}/action? by layer, and list the k-hop
action_id=filtered-query vertices or edges that meet
the filter criteria.

Filtered- POST /ges/v1.0/{project_id}/graphs/ This is a new version of the


query V2 {graph_name}/action? Filtered Query API. This API
action_id=path-query supports both Filtered Query
and Repeat Query functions.

Domain- POST /ges/v1.0/{project_id}/graphs/ Provide flexible and


Specific {graph_name}/action? controllable DSLs to help
Language action_id=algorithm-query users design and run
(DSL) algorithms at low costs.
Query
APIs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 15


Graph Engine Service(GES)
API Reference 2 API Overview

Operation URL Function

Updating POST /v1.0/{project_id}/graphs/ Update specified properties


Specified {graph_name}/action? of vertices and edges by
Properties action_id=import-properties importing a file.
of
Vertices
and
Edges by
Importing
a File

Deleting POST /v1.0/{project_id}/graphs/ Delete vertices and edges by


Vertices {graph_name}/action? reading the files.
and action_id=delete-by-file
Edges by
Reading
the Files

Intelligen POST /ges/v1.0/{project_id}/graphs/ Intelligent Q&A understands


t Q&A {graph_name}/conversations questions raised by users
(HDFS thanks to natural language
Scenario) analysis and processing and
uses structured knowledge in
GES graphs for query and
inference to provide accurate
answers to the questions.

2.2.2 Database Edition


Database edition service plane APIs include vertex operations, edge operations,
metadata operations, index operations, HyG dataset management, HyG algorithm,
HyG job management, native algorithms, graph statistics, graph operations, job
management, and Cypher operations.

Table 2-21 Vertex operation APIs


API URL Function

Querying GET/ges/v1.0/{project_id}/ Query details about a specified


Vertex graphs/{graph_name}/vertices/ vertex of a specified set of
Details detail?vertexIds={vertex_ids} vertices, including the label
information.

Querying POST/ges/v1.0/{project_id}/ Query vertex details in batches.


Vertex graphs/{graph_name}/vertices/
Data in action?action_id=batch-query
Batches

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 16


Graph Engine Service(GES)
API Reference 2 API Overview

API URL Function

Adding POST /ges/v1.0/{project_id}/ Add vertices in batches.


Vertices graphs/{graph_name}/vertices/
in action?action_id=batch-add
Batches

Deleting POST /ges/v1.0/{project_id}/ Delete vertices in batches


Vertices graphs/{graph_name}/vertices/ based on the vertex IDs.
in action?action_id=batch-delete
Batches

Updating POST /ges/v1.0/{project_id}/ Update vertex properties in


Vertex graphs/{graph_name}/vertices/ batches.
Propertie properties/action?
s in action_id={actionId}
Batches

Table 2-22 Edge operation APIs


API URL Function

Querying GET /ges/v1.0/{project_id}/ Query the details about an


Edge graphs/{graph_name}/edges/ edge based on its source and
Details detail? target vertices, including the
source={sourceVertex}&target={t edge's label information.
argetVertex}&index={index}

Querying POST/ges/v1.0/{project_id}/ Query edge details in batches.


Edge graphs/{graph_name}/edges/
Data in action?action_id=batch-query
Batches

Adding POST /ges/v1.0/{project_id}/ Add edges in batches.


Edges in graphs/{graph_name}/edges/
Batches action?action_id=batch-add

Deleting POST /ges/v1.0/{project_id}/ Delete edges in batches based


Edges in graphs/{graph_name}/edges/ on the source vertices, target
Batches action?action_id=batch-delete vertices, and indexes of the
edges.

Updating POST /ges/v1.0/{project_id}/ Update edge properties in


Edge graphs/{graph_name}/edges/ batches.
Properties properties/action?
in action_id={actionId}
Batches

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 17


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-23 Metadata operation APIs


API URL Function

Adding a POST /ges/v1.0/{project_id}/ Add a label.


Label graphs/{graph_name}/schema/
labels

Updating POST /ges/v1.0/{project_id}/ Update a label.


a Label graphs/{graph_name}/schema/
labels/{label_name}/properties

Querying GET /ges/v1.0/{project_id}/ Query metadata details.


Graph graphs/{graph_name}/schema
Metadata
Details

Querying GET /ges/v1.0/{project_id}/ Query labels.


Labels graphs/{graph_name}/schema?
label={labelName}

Table 2-24 Index operation APIs


API URL Function

Creating POST /ges/v1.0/{project_id}/ Create an index.


an Index graphs/{graph_name}/indices

Deleting DELETE /ges/v1.0/{project_id}/ Delete an index.


an Index graphs/{graph_name}/indices/
{indexName}

Querying GET /ges/v1.0/{project_id}/graphs/ Query indexes.


Indexes {graph_name}/indices

Creating POST /ges/v1.0/{project_id}/ Create indexes in batches. By


Indexes graphs/{graph_name}/ indices/ doing so, the number of data
in action?action_id=batch-build scans is reduced and the
Batches overall time required is
shorten.

Table 2-25 HyG graph management APIs


API URL Function

Creating POST /ges/v1.0/{project_id}/hyg/ Create a HyG graph.


a HyG {graph_name}
Graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 18


Graph Engine Service(GES)
API Reference 2 API Overview

API URL Function

Synchroni POST /ges/v1.0/{project_id}/hyg/ Synchronize graph database


zing HyG {graph_name}/sync updates to the HyG
Graph computing engine.
Data

Querying GET /ges/v1.0/{project_id}/hyg/ Query general information


General {graph_name}/summary about a HyG graph, such as
Informati the number of vertices,
on About number of edges, properties,
a HyG and partitioning policies.
Graph

Deleting DELETE /ges/v1.0/{project_id}/hyg/ Delete a HyG graph.


a HyG {graph_name}
Graph

Listing GET /ges/v1.0/{project_id}/hyg List HyG graphs.


HyG
Graphs

Table 2-26 HyG algorithm API


API URL Function

Runing POST /ges/v1.0/{project_id}/ Run the HyG algorithm.


Algorith graphs/{graph_name}/hyg/
ms algorithm

Table 2-27 HyG job management APIs


API URL Function

Dumping POST /ges/v1.0/{project_id}/hyg/ Dump the execution results of


HyG {graph_name}/jobs/{job_id}/ the algorithm (jobId) to OBS.
Algorith export-result
m Results

Canceling DELETE /ges/v1.0/{project_id}/hyg/ Cancel a submitted HyG job.


a HyG {graph_name}/jobs/{job_id} (Currently, only jobs in a
Job queue can be canceled.)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 19


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-28 Native algorithm API


API URL Function

Runing POST /ges/v1.0/{project_id}/ Run native algorithms.


Algorith graphs/{graph_name}/action?
ms action_id=execute-algorithm

Table 2-29 Graph statistics APIs


API URL Function

Querying GET /ges/v1.0/{project_id}/graphs/ Query general information


General {graph_name}/summary about a graph.
Informati
on About
a Graph

Querying GET /ges/v1.0/{project_id}/graphs/ Query the graph version.


the Graph {graph_name}/version
Version

Table 2-30 Graph operation APIs


API URL Function

Importing POST /ges/v1.0/{project_id}/graphs/ Import graph data.


a Graph {graph_name}/action?action_id=
import-graph

Clearing POST /ges/v1.0/{project_id}/graphs/ Clear graph data.


a Graph {graph_name}/action?
action_id=clear-graph

Exporting POST /ges/v1.0/{project_id}/graphs/ Export graph data.


a Graph {graph_name}/action?
action_id=export-graph

Creating POST /ges/v1.0/{project_id}/graphs Create a graph.


a Graph

Deleting DELETE /ges/v1.0/{project_id}/ Delete a graph.


a Graph graphs/{graph_name}

Listing GET /ges/v1.0/{project_id}/graphs List graphs.


Graphs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 20


Graph Engine Service(GES)
API Reference 2 API Overview

Table 2-31 Job management APIs


API URL Function

Querying GET/ges/v1.0/{project_id}/graphs/ Query the job status.


Job {graph_name}/jobs/{job_id}/status?
Status offset=offset&limit=limit

Querying GET /ges/v1.0/{project_id}/graphs/ After the ID of an


the Job {graph_name}/jobs/status? asynchronous job is returned,
List limit={limit}&offset={offset} if the job ID at the service
layer is lost and cannot be
obtained through the API, a
new API is provided to query
all asynchronous jobs stored
in the engine. The job ID, job
status, and original request
of each job are returned.

Table 2-32 Cypher operation APIs


API URL Function

Cypher POST /ges/v1.0/{project_id}/graphs/ Run Cypher statements to


Operatio {graph_name}/action? query data in GES and obtain
n APIs action_id=execute-cypher-query results.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 21


Graph Engine Service(GES)
API Reference 3 Calling APIs

3 Calling APIs

3.1 Making an API Request

3.1.1 Making a Management Plane API Request


This section describes the structure of a REST API request on the management
plane of GES.

Request URI
A request URI is in the following format:

{URI-scheme} :// {Endpoint} / {resource-path} ? {query-string}

Although a request URI is included in the request header, most programming


languages or frameworks require the request URI to be transmitted separately.

● URI-scheme: Protocol used to transmit requests. All APIs use HTTPS.


● Endpoint: Obtain the endpoint by following the steps provided in Obtaining
an Endpoint.
● resource-path: Access path of an API for performing a specified operation.
Obtain the path from the URI of an API. For example, the resource-path of
the API used to obtain a user token is /v3/auth/tokens.
● query-string: Query parameter, which is optional. Ensure that a question
mark (?) is included before each query parameter that is in the format of
"Parameter name=Parameter value". For example, ? limit=10 indicates that a
maximum of 10 data records will be displayed.

Request Methods
The HTTP protocol defines the following request methods that can be used to
send a request to the server:

● GET: requests the server to return specified resources.


● PUT: requests the server to update specified resources.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 22


Graph Engine Service(GES)
API Reference 3 Calling APIs

● POST: requests the server to add resources or perform special operations.


● DELETE: requests the server to delete specified resources, for example, an
object.
● HEAD: same as GET except that the server must return only the response
header.
● PATCH: requests the server to update partial content of a specified resource.
If the resource does not exist, a new resource will be created.

Request Header
You can also add additional header fields to a request, such as the fields required
by a specified URI or HTTP method. For example, to request for the authentication
information, add Content-Type, which specifies the request body type.
Common request header fields are as follows:

Table 3-1 Common request headers


Parameter Mandatory Description Example

Content-Type Yes Specifies the request application/json


body type or format. This
field is mandatory and its
default value is
application/json. Other
values of this field will be
provided for specific APIs
if any.

X-Auth-Token This field is Specifies a user token -


mandatory only for token-based API
only for authentication.
authenticati
on using
tokens.

X-Project-ID This field is Specifies a subproject ID. e9993fc787d94b6c8


mandatory This parameter is 86cbaa340f9c0f4
only for mandatory only in multi-
AK/SK project scenarios.
authenticati
on.

Authorization This field is Specifies the signature -


mandatory authentication
for information. The value is
authenticati obtained from the
on using request signing result.
AK/SK.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 23


Graph Engine Service(GES)
API Reference 3 Calling APIs

Parameter Mandatory Description Example

X-Sdk-Date This field is Specifies the time when a 20150907T101459Z


mandatory request is sent. The time
for is in
authenticati YYYYMMDDTHHMMSSZ
on using format.
AK/SK. The value is the current
Greenwich Mean Time
(GMT) time of the
system.

Host This field is Specifies the information code.test.com


mandatory about the requested or
for server. The value can be
authenticati obtained from the URL of code.test.com:443
on using the service API. The value
AK/SK. is in the hostname[:port]
format. Default port used
for https requests is port
443.

Content- This field is Specifies the length of 3495


Length mandatory the request body. The
for POST unit is byte.
and PUT
requests,
but must
be left
blank for
GET
requests.

X-Language No Request language en-us

NOTE

In addition to token-based authentication, authentication using access key ID/secret access


key (AK/SK) is also supported. During AK/SK-based authentication, an SDK is used to sign
the request, and the Authorization (signature information) and X-Sdk-Date (time when
the request is sent) header fields are automatically added to the request.

Request Body
The body of a request is often sent in a structured format as specified in the
Content-Type header field. The request body transfers content except the request
header.
The request body varies between APIs. Some APIs do not require the request body,
such as the APIs requested using the GET and DELETE methods.
For the API of obtaining a user token, obtain the request parameters and
parameter description in the API request. The following provides an example

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 24


Graph Engine Service(GES)
API Reference 3 Calling APIs

request with a body included. Replace username, domianname, ******** (login


password), and xxxxxxxxxxxxxxxxxx (project name) with the actual values. You can
obtain the endpoint from Obtaining an Endpoint.
If all data required for the API request is available, you can send the request to call
the API through code. In the response to the API used to obtain a user token, x-
subject-token is the desired user token. This token can then be used to
authenticate the calling of other APIs.

3.1.2 Making a Service Plane API Request


This section describes the structure of a REST API on the service plane of GES.

Request URI
A request URI of a service plane API of GES is in the following format:
{URI-scheme} :// {SERVER_URL} / {resource-path} ? {query-string}
Although a request URI is included in the request header, most programming
languages or frameworks require the request URI to be transmitted separately.
● URI-scheme: Protocol used to transmit requests. All APIs use HTTPS.
● SERVER_URL: Address for accessing a graph. For details about its value, see
Using Service Plane APIs.
● resource-path: Access path of an API for performing a specified operation.
Obtain the value from the URI module of the API, for example, ges/v1.0/
{project_id}/graphs/{graph_name}/vertices/action?action_id=query.
● query-string: Query parameter, which is optional. Ensure that a question
mark (?) is included before each query parameter that is in the format of
"Parameter name=Parameter value". For example, ? limit=10 indicates that a
maximum of 10 data records will be displayed.

Request Methods
The HTTP protocol defines the following request methods that can be used to
send a request to the server:
● GET: requests the server to return specified resources.
● PUT: requests the server to update specified resources.
● POST: requests the server to add resources or perform special operations.
● DELETE: requests the server to delete specified resources, for example, an
object.
● HEAD: same as GET except that the server must return only the response
header.
● PATCH: requests the server to update partial content of a specified resource.
If the resource does not exist, a new resource will be created.

Request Header
You can also add additional header fields to a request, such as the fields required
by a specified URI or HTTP method. For example, to request for the authentication
information, add Content-Type, which specifies the request body type.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 25


Graph Engine Service(GES)
API Reference 3 Calling APIs

Common request header fields are as follows:

Table 3-2 Common request headers


Parameter Man Description Example
dato
ry

Content- Yes Specifies the request application/json


Type body type or format.
This field is mandatory
and its default value is
application/json.
Other values of this
field will be provided
for specific APIs if any.

X-Auth- Yes Specifies a user token -


Token only for token-based
API authentication.

X-Language Yes Request language en-us

Request Message Body


The body of a request is often sent in a structured format as specified in Content-
Type. The request body transfers content except the request header.
The request body varies between APIs. Some APIs do not require the request body,
such as the APIs requested using the GET and DELETE methods.
For the API of obtaining a user token, obtain the request parameters and
parameter description in the API request. The following provides an example
request with a body included. Replace username, domianname, ******** (login
password), and xxxxxxxxxxxxxxxxxx (project name) with the actual values. You can
obtain the endpoint by referring to Obtaining an Endpoint.
If all data required for the API request is available, you can send the request to call
the API through code. In the response to the API used to obtain a user token, x-
subject-token is the desired user token. which can be used to authenticate the
calling of other APIs.

3.2 Authentication
You can use token authentication to invoke APIs.

Token-based Authentication
A token is used to acquire temporary permissions. During API authentication using
a token, the token is added to requests to get permissions for calling the API.
When calling an API to obtain a user token, you must set auth.scope in the
request body to project.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 26


Graph Engine Service(GES)
API Reference 3 Calling APIs

URL: https://iam-cache-proxy.{GLOBAL_DOMAIN_NAME}:26335/v3/auth/tokens
Header:
Content-Type: application/json
Body:
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "username", //Username
"password": "********", // Password
"domain": {
"name": "domainname" // Tenant to which the user belongs
}
}
}
},
"scope": {
"project": {
"id": "xxxxxxxx" // ID of the resource set for which the token is used
}
}
}
}

After a token is obtained, the X-Auth-Token header field must be added to


requests to specify the token when calling other APIs. For example, if the token is
ABCDEFJ...., add X-Auth-Token: ABCDEFJ.... to a request as follows:

Content-Type: application/json

X-Auth-Token: ABCDEFJ....

NOTE

1. A token is valid for 24 hours. When using a token for authentication, cache it to prevent
frequently calling the IAM API used to obtain a user token.
2. Name of the tenant to which the user belongs can be obtained by performing the
following steps:
1. Log in to ManageOne Operation Portal.
2. Hover your cursor over the username in the upper right corner and choose My
Settings from the drop-down list.
3. On the My Settings page, the tenant displayed is the name of the tenant to which
the user belongs.
3. Before calling the IAM API to obtain the token, perform the following steps to write the
mapping between the IAM address and domain name into the hosts file of the system:
1. Replace GLOBAL_DOMAIN_NAME in the example with the plan value of
global_domain_name in the 1.1 "Basic Parameters" sheet of the table exported
from HCCI Turnkey tool when the GES service is installed.

2. Search for ManageOne-Tenant-Float-IP on the "2.1 Basic_Parameters" sheet in the


xxx__export_all_v2_CN.xlsx file exported during installation.

4. Open the C:\Windows\System32\drivers\etc\hosts file and add the IP address


obtained in the previous step and the domain name iam-cache-proxy.
{GLOBAL_DOMAIN_NAME} to the last line of the file.
{IP} {iam-cache-proxy.{GLOBAL_DOMAIN_NAME}}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 27


Graph Engine Service(GES)
API Reference 3 Calling APIs

3.3 Response
Status Code
After sending a request, you will receive a response, including a status code,
response header, and response body.
A status code is a group of digits, ranging from 1xx to 5xx. It indicates the status
of a request. For more information, see Status Codes.

Response Header
Similar to a request, a response also has a header, for example, Content-Type.
Table 3-3 list the response header parameters.

Table 3-3 Response header parameters


Parameter Description

Content-Length Specifies the length (in bytes) of the response body.

Date Specifies the time when a response is returned.

Content-type Specifies the MIME type of the response body.

TraceID Specifies the ID returned by the request, facilitating


fault locating.

Response Body
The body of a response is often returned in structured format as specified in the
Content-Type header field. The response body transfers content except the
response header.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 28


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

4 Management Plane APIs (V2)

4.1 System Management

4.1.1 Querying Quotas


Function
This API is used to query tenant quotas.

URI
GET /v2/{project_id}/graphs/quotas

Table 4-1 URI parameters


Parameter Mandator Type Description
y

project_id Yes String Project ID. For details about how


to obtain the project ID, see
Obtaining a Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 29


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-2 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain the
token, see Authentication. The
value of X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-3 Response body parameters

Parameter Type Description

quotas quotas Object Resource type list. This field is left blank when
the request fails.

Table 4-4 quotas

Parameter Type Description

resources Array of GES resource quota list


resources
objects

Table 4-5 resources

Parameter Type Description

type String Quota type


Available values are as follows:
● "graph"
● "backup"
● "metadata"

available Integer Number of available graphs

edge_volume Integer Number of available edges. The parameter


value is valid only when type is graph.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 30


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Status code: 400

Table 4-6 Response body parameters

Parameter Type Description

error_code String System prompt code.


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

error_msg String System prompt.


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

Example Request
Query tenant quotas.
GET https://Endpoint/v2/{project_id}/graphs/quotas

Example Response
Status code: 200

Example response (successful request)


{
"quotas" : {
"resources" : [ {
"type" : "graph",
"available" : 10,
"edge_volume" : 7300
}, {
"type" : "backup",
"available" : 100
}, {
"type" : "metadata",
"available" : 86
}]
}
}

Status code: 400

Example response (failed request)


{
"error_code" : "GES.7006",
"error_msg" : "An internal error occurs in the underlying service of the graph engine."
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 31


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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.

4.2 Graph Management

4.2.1 Querying the Graph List

Function
This API is used to query all graphs of the current tenant.

URI
GET /v2/{project_id}/graphs

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

Table 4-8 Query parameters

Parameter Mandatory Type Description

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 32


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

Request Parameters

Table 4-9 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-10 Response body parameters

Parameter Type Description

graph_count Integer Total number of graphs. Graph object. If the


request fails, this parameter is left empty.

graphs Array of Graph list. Graph object. If the request fails,


graphs this parameter is left empty.
objects

Table 4-11 graphs

Parameter Type Description

id String Graph ID

name String Graph name

created_by String IAM username

is_multi_az String Whether cross-AZ HA will be enabled

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 33


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

region_code String Region code

az_code String AZ code

edgeset_form String Format of the edge data file


at

edgeset_defa String Default label of the edge data file


ult_label

vertexset_for String Format of the vertex data file


mat

vertexset_def String Default label of the vertex data file


ault_label

data_store_ve String Graph version


rsion

sys_tags Array of Enterprise project information. If this


strings parameter is not specified, this function is
disabled (default).

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 34


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

status String Status code of a graph


● 100: Indicates that a graph is being
prepared.
● 200: indicates that a graph is running.
● 201: indicates that a graph is upgrading.
● 202: indicates that a graph is being
imported.
● 203: indicates that a graph is being rolled
back.
● 204: indicates that a graph is being
exported.
● 205: indicates that a graph is being cleared.
● 206: indicates that the system is preparing
for resize.
● 207: indicates that the resize is in progress.
● 208: Indicates that the resize is being rolled
back.
● 210: Preparing for expansion
● 211: Expanding
● 300: indicates that a graph is faulty.
● 303: indicates that a graph fails to be
created.
● 400: indicates that a graph is deleted.
● 800: indicates that a graph is frozen.
● 900: indicates that a graph is stopped.
● 901: indicates that a graph is being stopped.
● 920: indicates that a graph is being started.

action_progre String Progress of graph creation


ss NOTE
This field is returned only when status is 100.

graph_size_ty String Graph size type index


pe_index ● 0: indicates 10 thousand edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million edges.
● 3: indicates 100 million edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion edges.
● 6: indicates the database edition.
● 401: indicates 1 billion enhanced edges.

vpc_id String VPC ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 35


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

subnet_id String Subnet ID in the VPC

security_grou String Security group ID


p_id

replication Integer Number of replicas. The default value is 1.

created String Time when a graph is created

updated String Time when a graph is updated

private_ip String Floating IP address of a graph instance. Users


can access the instance using the IP address
through the ECS deployed on a private
network.

public_ip String Public network access address of a graph


instance. Users can access the instance using
the IP address from the Internet.

arch String Graph instance's CPU architecture type. The


value can be x86_64 or aarch64.

master_key_id String User master key ID

master_key_n String User master key name


ame

enable_rbac Boolean Whether to enable granular permission control

enable_full_te Boolean Whether to enable full-text indexes


xt_index

enable_hyg Boolean Whether to enable HyG. This parameter is


available only for database edition graphs.

traffic_ip_list Array of Physical addresses of a graph instance for


strings access from private networks. To prevent
service interruption caused by floating IP
address switchover, poll the physical IP
addresses to access the graph instance.

crypt_algorith String Graph instance cryptography algorithm.


m Available values are as follows:
● generalCipher: Chinese cryptographic
algorithm
● SMcompatible: Commercial cryptography
algorithm (compatible with international
ones)

enable_https Boolean Whether to enable the security mode. This


mode may damage GES performance greatly.

tags Array of tags Tag list. Each tag is in <key,value> format.


objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 36


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

product_type String Graph type. The value can be InMemory


(default value) or Persistence. If
graph_size_type_index is 6, the value must be
Persistence.
● InMemory: memory edition
● Persistence: database version

vertex_id_type vertex_id_typ ID type of vertices. This parameter is


e object mandatory only for database edition graphs.
NOTE
The vertex ID type cannot be changed once set.
Exercise caution when setting this parameter.

Table 4-12 tags


Parameter Type Description

key String Tag key

value String Tag value

Table 4-13 vertex_id_type


Parameter Type Description

id_type String Vertex ID type. The value can be


fixedLengthString or hash.
● fixedLengthString: Vertex IDs are used for
internal storage and compute. Specify the
length limit. If the IDs are too long, the
query performance can be reduced. Specify
the length limit based on your dataset
vertex IDs.
● hash: Vertex IDs are converted into hash
code for storage and compute. There is no
limit on the ID length. However, there is an
extremely low probability, approximately
10^(-43), that the vertex IDs will conflict. If
you cannot determine the maximum length
of a vertex ID, set this parameter to Hash.

id_length Integer This parameter is mandatory if id_type is


fixedLengthString. The value ranges from 1 to
128.

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 37


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-14 Response body parameters


Parameter Type Description

error_msg String System prompt code.


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

error_code 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.

Example Request
View the first 10 graphs of the current tenant.
GET https://Endpoint/v2/{project_id}/graphs?offset=0&limit=10

Example Response
Status code: 200
Example response for a successful request
{
"graph_count" : 2,
"graphs" : [ {
"id" : "146227d2-bfac-499a-97df-df475349e43d",
"name" : "TenThousand_Charging",
"created_by" : "ei_ges_j00356469_01",
"is_multi_az" : "false",
"region_code" : "XXX",
"az_code" : "XXX",
"edgeset_format" : "",
"edgeset_default_label" : "",
"vertexset_format" : "",
"vertexset_default_label" : "",
"data_store_version" : "2.3.2",
"sys_tags" : [ "0" ],
"status" : "200",
"graph_size_type_index" : "0",
"vpc_id" : "0ac6e3c3-2c9b-4296-84f7-6883cebc7b41",
"subnet_id" : "2b1755eb-d6d4-421f-88c0-cf6f0bc16801",
"security_group_id" : "7aa7c8c9-7443-4a01-abf5-8064b586f8f5",
"replication" : 1,
"created" : "2022-04-26T02:19:54",
"private_ip" : "192.168.0.228",
"arch" : "x86_64",
"encrypted" : false,
"master_key_id" : "",
"master_key_name" : "",
"enable_rbac" : false,
"enable_full_text_index" : false,
"enable_hyg" : false,
"traffic_ip_list" : [ "192.168.0.228" ],
"crypt_algorithm" : "generalCipher",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 38


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"enable_https" : false
}, {
"id" : "1172f16c-63c7-4746-89b0-78972eddf706",
"name" : "GES_UI_2_0_1",
"created_by" : "ei_ges_j00356469_01",
"is_multi_az" : "false",
"region_code" : "XXX",
"az_code" : "XXX",
"edgeset_format" : "",
"edgeset_default_label" : "",
"vertexset_format" : "",
"vertexset_default_label" : "",
"data_store_version" : "2.0.1",
"sys_tags" : [ "0" ],
"status" : "900",
"graph_size_type_index" : "0",
"vpc_id" : "0ac6e3c3-2c9b-4296-84f7-6883cebc7b41",
"subnet_id" : "2b1755eb-d6d4-421f-88c0-cf6f0bc16801",
"security_group_id" : "7aa7c8c9-7443-4a01-abf5-8064b586f8f5",
"replication" : 1,
"created" : "2022-04-26T02:10:52",
"private_ip" : "192.168.0.123",
"encrypted" : false,
"enable_rbac" : false,
"enable_full_text_index" : false,
"enable_hyg" : false,
"traffic_ip_list" : [ "192.168.0.123" ],
"crypt_algorithm" : "generalCipher",
"enable_https" : false
}]
}

Status code: 400

Example response for a failed request


{
"error_code" : "GES.7006",
"error_msg" : "An internal error occurs in the underlying service of the graph engine."
}

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.

930 Host Upgrading Upgrading host.

Error Codes
See Error Codes.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 39


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

4.2.2 Querying Graph Details

Function
This API is used to query details about a graph based on the graph ID.

URI
GET /v2/{project_id}/graphs/{graph_id}

Table 4-15 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_id Yes String Graph ID

Request Parameters

Table 4-16 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-17 Response body parameters

Parameter Type Description

graph graph object Graph object. If the request fails, this


parameter is left empty.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 40


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-18 graph


Parameter Type Description

id String Graph ID

name String Graph name

created_by String IAM username

is_multi_az String Whether to enable cross-AZ HA

region_code String Region code

az_code String AZ code

edgeset_form String Format of the edge data file


at

edgeset_defa String Default label of the edge data file


ult_label

vertexset_for String Format of the vertex data file


mat

vertexset_def String Default label of the vertex data file


ault_label

data_store_ve String Graph version


rsion

sys_tags Array of Enterprise project information. If this


strings parameter is not specified, this function is
disabled (default).

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 41


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

status String Status code of a graph:


● 100: Indicates that a graph is being
prepared.
● 200: indicates that a graph is running.
● 201: indicates that a graph is upgrading.
● 202: indicates that a graph is being
imported.
● 203: indicates that a graph is being rolled
back.
● 204: indicates that a graph is being
exported.
● 205: indicates that a graph is being cleared.
● 206: indicates that the system is preparing
for resize.
● 207: indicates that the resize is in progress.
● 208: Indicates that the resize is being rolled
back.
● 210: Preparing for expansion
● 211: Expanding
● 300: indicates that a graph is faulty.
● 303: indicates that a graph fails to be
created.
● 400: indicates that a graph is deleted.
● 800: indicates that a graph is frozen.
● 900: indicates that a graph is stopped.
● 901: indicates that a graph is being stopped.
● 920: indicates that a graph is being started.

action_progre String Progress of graph creation


ss NOTE
This field is returned only when status is 100.

graph_size_ty String Graph size type index:


pe_index ● 0: indicates 10 thousand edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million edges.
● 3: indicates 100 million edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion edges.
● 6: indicates the database edition.
● 401: indicates 1 billion enhanced edges.

vpc_id String VPC ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 42


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

subnet_id String Subnet ID in the VPC

security_grou String Security group ID


p_id

replication Integer Number of replicas. The default value is 1.

created String Time when a graph is created

updated String Time when a graph is updated

private_ip String Floating IP address of a graph instance. Users


can access the instance using the IP address
through the ECS deployed on a private
network.

public_ip String Public network access address of a graph


instance. Users can access the instance using
the IP address from the Internet.

arch String Graph instance's CPU architecture type. The


value can be x86_64 or aarch64.

master_key_id String User master key ID

master_key_n String User master key name


ame

enable_rbac Boolean Whether to enable granular permission control

enable_full_te Boolean Whether to enable full-text indexes


xt_index

enable_hyg Boolean Whether to enable HyG. This parameter is


available only for database edition graphs.

traffic_ip_list Array of Physical addresses of a graph instance for


strings access from private networks. To prevent
service interruption caused by floating IP
address switchover, poll the physical IP
addresses to access the graph instance.

crypt_algorith String Graph instance cryptography algorithm.


m Available values are as follows:
● generalCipher: Chinese cryptographic
algorithm
● SMcompatible: Commercial cryptography
algorithm (compatible with international
ones)

enable_https Boolean Whether to enable the security mode. This


mode may damage GES performance greatly.

tags Array of tags Tag list. Each tag is in <key,value> format.


objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 43


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

product_type String Graph type. The value can be InMemory


(default value) or Persistence. If
graph_size_type_index is 6, the value must be
Persistence.
● InMemory: memory edition
● Persistence: database version

vertex_id_type vertex_id_typ ID type of vertices. This parameter is


e object mandatory only for database edition graphs.
NOTE
The vertex ID type cannot be changed once set.
Exercise caution when setting this parameter.

origin_graph_ String Initial size of a graph.


size_type_inde
x

expand_time String Time when a graph is expanded.

resize_time String Time when a graph is resized.

enable_multi_ Boolean Whether multi-labeling is enabled.


label

capacity_ratio Integer Capacity rate of a graph. This parameter is


returned only for 10-billion-edge graphs of the
database edition.

Table 4-19 tags


Parameter Type Description

key String Tag key.

value String Tag value

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 44


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-20 vertex_id_type


Parameter Type Description

id_type String Vertex ID type. The value can be


fixedLengthString or hash.
● fixedLengthString: Vertex IDs are used for
internal storage and compute. Specify the
length limit. If the IDs are too long, the
query performance can be reduced. Specify
the length limit based on your dataset
vertex IDs.
● hash: Vertex IDs are converted into hash
code for storage and compute. There is no
limit on the ID length. However, there is an
extremely low probability, approximately
10^(-43), that the vertex IDs will conflict. If
you cannot determine the maximum length
of a vertex ID, set this parameter to Hash.

id_length Integer This parameter is mandatory if id_type is


fixedLengthString. The value ranges from 1 to
128.

Status code: 400

Table 4-21 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Query details about a graph based on the graph ID.
GET https://Endpoint/v2/{project_id}/graphs/{graph_id}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 45


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example Response
Status code: 200

Example response for a successful request


{
"graph" : {
"id" : "1172f16c-63c7-4746-89b0-78972eddf706",
"name" : "GES_UI_2_0_1",
"created_by" : "ei_ges_j00356469_01",
"is_multi_az" : "false",
"region_code" : "XXX",
"az_code" : "XXX",
"edgeset_format" : "",
"edgeset_default_label" : "",
"vertexset_format" : "",
"vertexset_default_label" : "",
"data_store_version" : "2.0.1",
"sys_tags" : [ "0" ],
"status" : "900",
"graph_size_type_index" : "0",
"vpc_id" : "0ac6e3c3-2c9b-4296-84f7-6883cebc7b41",
"subnet_id" : "2b1755eb-d6d4-421f-88c0-cf6f0bc16801",
"security_group_id" : "7aa7c8c9-7443-4a01-abf5-8064b586f8f5",
"replication" : 0,
"created" : "2022-04-26T02:10:52",
"updated" : "2022-04-26T02:10:52",
"private_ip" : "192.168.0.123",
"encrypted" : false,
"enable_rbac" : false,
"enable_full_text_index" : false,
"enable_hyg" : false,
"traffic_ip_list" : [ "192.168.0.123" ],
"crypt_algorithm" : "generalCipher",
"enable_https" : false,
"enable_multi_label":false,
"origin_graph_size_type_index": "1",
"expand_time": "2023-08-03T02:10:52",
"resize_time": "2023-08-02T02:10:52"
}
}

Status code: 400

Example response for a failed request


{
"error_code" : "GES.7006",
"error_msg" : "An internal error occurs in the underlying service of the graph engine."
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 46


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Return Value Description

503 Service Unavailable Service unavailable.

930 Host Upgrading Upgrading host.

Error Codes
See Error Codes.

4.2.3 Creating a Graph


Function
This API is used to create a graph.

URI
POST /v2/{project_id}/graphs

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

Request Parameters

Table 4-23 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 47


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-24 Request body parameter


Parameter Mandatory Type Description

graph Yes graph object Graph type

Table 4-25 graph


Parameter Mandatory Type Description

name Yes String A graph name must start with


a letter and contains 4 to 50
characters consisting of letters,
digits, hyphens (-), and
underscores (_). It cannot
contain special characters.

graph_size_ty Yes String Graph size type index:


pe_index ● 0: indicates 10 thousand
edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million
edges.
● 3: indicates 100 million
edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion
edges.
● 6: indicates the database
edition.
● 401: indicates 1 billion
enhanced edges.

arch No String Graph instance's CPU


architecture type. The value
can be x86_64 or aarch64.
The default value is x86_64.
● x86_64: x86 64-bit
architecture
● aarch64: Arm 64-bit
architecture

vpc_id Yes String VPC ID

subnet_id Yes String Subnet ID in the VPC

security_grou Yes String Security group ID


p_id

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 48


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

public_ip No public_ip Public IP address. If the


object parameter is not specified,
public connection is not used
by default.

enable_multi_ No Boolean Whether the created graph


az supports the cross-AZ mode.
The default value is false. If
the value is true, the system
will create the ECSs in the
graph in two AZs.
If this parameter is not
specified when you create a
graph, all ECSs in the graph
are created in one AZ.

lts_operation_ No lts_operation Whether to enable audit logs.


trace _trace object This function is disabled by
default.

sys_tags No Array of Enterprise project information.


sys_tags If this parameter is not
objects specified, this function is
disabled (default).

tags No Array of tags TMS tags for expenses. This


objects function is disabled by default.

enable_rbac No Boolean Whether to enable granular


permission control for the
created graph. The default
value is false, indicating that
granular permission control is
disabled. If this parameter is
set to true, no user has the
permission to access the
graph. To access the graph,
you need to call the granular
permission control API of the
service plane to set the
required permissions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 49


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

enable_full_te No Boolean Whether to enable full-text


xt_index index control for the created
graph. The default value is
false, indicating that full-text
index control is disabled. If
this parameter is set to true,
full-text indexes are available
for 1-billion-edge-pro graphs,
and a Cloud Search Service
(CSS) cluster will be created
when you create a graph.
NOTE
If you enable full-text indexes: If
the CSS has been deployed, the
system automatically creates a
CSS cluster during the creation of
the graph instance, which will
take a long time. If the CSS is not
deployed, the graph creation will
fail.

enable_hyg No Boolean Whether to enable HyG for


the graph. This parameter is
available for database edition
graphs only.

crypt_algorith Yes String Graph instance cryptography


m algorithm. Available values are
as follows:
● generalCipher: Chinese
cryptographic algorithm
● SMcompatible:
Commercial cryptography
algorithm (compatible with
international ones)

enable_https Yes Boolean Whether to enable the


security mode. This mode may
damage GES performance
greatly.

product_type No String Graph type. The value can be


InMemory (default value) or
Persistence. If
graph_size_type_index is 6,
the value must be
Persistence.
● InMemory: memory edition
● Persistence: database
version

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 50


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

vertex_id_type No vertex_id_typ ID type of vertices. This


e object parameter is mandatory only
for database edition graphs.
NOTE
The vertex ID type cannot be
changed once set. Exercise
caution when setting this
parameter.

enable_multi_ No Boolean Whether multi-labeling is


label enabled.

capacity_ratio No Integer Capacity rate of a graph. This


parameter is returned only for
10-billion-edge graphs of the
database edition.

Table 4-26 public_ip


Parameter Mandatory Type Description

public_bind_ty No String Binding type of an EIP. The


pe value can be either of the
following:
● auto_assign
● bind_existing

eip_id No String ID of an EIP. When


publicBindType is set to
bind_existing, its value is the
ID of an EIP that has been
created but has not been
bound. When publicBindType
is set to auto_assign, its value
is set to null.

Table 4-27 lts_operation_trace


Parameter Mandatory Type Description

enable_audit No Boolean Whether to enable graph


audit. The default value is
false.

audit_log_gro No String LTS log group name


up_name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 51


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-28 sys_tags


Parameter Mandatory Type Description

key No String Key of the enterprise project.


The value is
_sys_enterprise_project_id.

value No String Enterprise project ID. You can


obtain it from the enterprise
project.

Table 4-29 tags


Parameter Mandatory Type Description

key No String Tag key

value No String Tag value

Table 4-30 vertex_id_type


Parameter Mandatory Type Description

id_type Yes String Vertex ID type. The value can


be fixedLengthString or
hash.
● fixedLengthString: Vertex
IDs are used for internal
storage and compute.
Specify the length limit. If
the IDs are too long, the
query performance can be
reduced. Specify the length
limit based on your dataset
vertex IDs.
● hash: Vertex IDs are
converted into hash code
for storage and compute.
There is no limit on the ID
length. However, there is an
extremely low probability,
approximately 10^(-43),
that the vertex IDs will
conflict. If you cannot
determine the maximum
length of a vertex ID, set
this parameter to Hash.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 52


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

id_length No Integer This parameter is mandatory if


id_type is fixedLengthString.
The value ranges from 1 to
128.

Response Parameters
Status code: 200

Table 4-31 Response body parameters


Parameter Type Description

id String Graph ID

name String Graph name

Status code: 400

Table 4-32 Response body parameters


Parameter Type Description

error_msg String System prompt code.


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

error_code 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.

Example Request
Create a graph. The graph name is demo, the graph size is 10-thousand-edge, the
graph instance CPU architecture type is x86 64-bit, the VPC ID is f07ed478-
c31e-47ed-92d4-8fae6fd16981, the subnet ID is 70bc9d11-
b172-479b-8bce-1ad1ade02224, and the security group ID is
65de00b0-45f5-432f-8346-d8bb5f30940d.
{
"graph": {
"name": "demo",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 53


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"graph_size_type_index": 0,
"capacity_ratio": "",
"arch": "x86_64",
"vpc_id": "f07ed478-c31e-47ed-92d4-8fae6fd16981",
"subnet_id": "70bc9d11-b172-479b-8bce-1ad1ade02224",
"security_group_id": "65de00b0-45f5-432f-8346-d8bb5f30940d",
"public_ip": {
"public_bind_type": "bind_existing",
"eip_id": "b6e3bc7d-1ced-4690-9219-ef41d25e171e"
},
"enable_multi_az": false,

"lts_operation_trace": {
"enable_audit": true,
"audit_log_group_name": "test"
},
"sys_tags": [
{
"key": "_sys_enterprise_project_id",
"value": "0"
}
],
"enable_hyg":false,
"crypt_algorithm": "generalCipher",
"enable_https" : false
}
}

Example Response
Status code: 200

Example response (successful request)


{
"id" : "f1529b88-c958-493e-8452-fccfe932cde1",
"name" : "demo"
}

Status code: 400

Example response (failed request)


{
"error_code" : "GES.7016",
"error_msg" : "The parameter [subnetId] is not exist."
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 54


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Error Codes
See Error Codes.

4.2.4 Closing a Graph


Function
This API is used to close a graph. After the graph is created, you can disable it if it
is not used temporarily.

URI
POST /v2/{project_id}/graphs/{graph_id}/stop

Table 4-33 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_id Yes String Graph ID

Request Parameters

Table 4-34 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 55


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-35 Response body parameters


Parameter Type Description

job_id String ID of the graph stopping job. Graph object. If


the request fails, this parameter is left empty.

Table 4-36 Response body parameters


Parameter Type Description

error_msg String System prompt code.


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

error_code 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.

Example Request
Close a graph.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/stop
{}

Example Response
Status code: 200
Example response for a successful request
{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Example response for a failed request
{
"error_code" : "GES.7001",
"error_msg" : "The graph is not running."
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 56


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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.

4.2.5 Starting a Graph


Function
This API is used to start a graph. You can disable a graph if it is not used
temporarily.

URI
POST /v2/{project_id}/graphs/{graph_id}/start

Table 4-37 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 57


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-38 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-39 Request body parameters


Parameter Mandatory Type Description

graph_backup No String Backup ID associated during


_id graph startup. If this
parameter is configured, the
graph starts from the backup.
If this parameter is left blank,
the graph starts from the
status when it was closed last
time.

Response Parameters
Status code: 200

Table 4-40 Response body parameters


Parameter Type Description

job_id String ID of the graph startup job. This parameter is


left blank when the request fails.

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 58


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-41 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Start a graph whose associated backup ID is 08a898ae-3ff8-40e8-
a7ed-03afe05aedbb.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/start

{
"graph_backup_id" : "08a898ae-3ff8-40e8-a7ed-03afe05aedbb"
}

Example Response
Status code: 200

Example response (successful request)


{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400

Example response (failed request)


{
"error_code" : "GES.7006",
"error_msg" : "An internal error occurs in the underlying service of the graph engine."
}

Status Code
Return Value Description

400 Bad Request Request error

401 Unauthorized Authorization failed

403 Forbidden No operation permissions

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 59


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Return Value Description

404 Not Found No resources found

500 Internal Server Error Internal server error

503 Service Unavailable Service unavailable

Error Code
See Error Code.

4.2.6 Deleting a Graph


Function
This API is used to delete a graph.

URI
DELETE /v2/{project_id}/graphs/{graph_id}

Table 4-42 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_id Yes String Graph ID

Table 4-43 Query parameters


Parameter Mandatory Type Description

keep_backup No Boolean Whether to retain the backups


of a graph after it is deleted.
By default, one automatic
backup and two manual
backups are retained. If this
parameter is left empty, no
backups are retained.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 60


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-44 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-45 Response body parameters


Parameter Type Description

job_id String ID of the graph deletion job. This parameter is


left blank when the request fails.

Status code: 400

Table 4-46 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Delete a graph.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 61


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

DELETE https://Endpoint/v2/{project_id}/graphs/{graph_id}

Example Response
Status code: 200

Example response for a successful request


{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400

Example response for a failed request


{
"error_code" : "GES.7000",
"error_msg" : "The graph does not exist or has been deleted."
}

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.

4.2.7 Incrementally Importing Data to a Graph

Function
This API is used to import data to graphs incrementally.

NOTE

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

URI
POST /v2/{project_id}/graphs/{graph_id}/import-graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 62


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-47 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_id Yes String Graph ID

Request Parameters

Table 4-48 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain the
token, see Authentication. The
value of X-Subject-Token in the
response header is the token.

Table 4-49 Request body parameters


Parameter Mandatory Type Description

edgeset_path No String Edge file directory or name

edgeset_form No String Format of the edge data set.


at Currently, only the CSV format is
supported.
The CSV format is used by
default.

vertexset_pat No String Vertex file directory or name


h

vertexset_for No String Format of the vertex data set.


mat Currently, only the CSV format is
supported.
The CSV format is used by
default.

schema_path No String Path for storing the metadata


file of the new data.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 63


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

log_dir No String Directory for storing logs of


imported graphs. This directory
stores the data that fails to be
imported during graph creation
and detailed error causes.

parallel_edge No parallel_ed How to process repetitive edges.


ge object

delimiter No String 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 (;).

trim_quote No String 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.

offline No Boolean Whether offline import is


selected. The value is true or
false, and the default value is
false.
● true: Offline import is
selected. The import speed is
high, but the graph is locked
and cannot be read or written
during the import.
● false: Online import is
selected. Compared with
offline import, online import
is slower. However, the graph
can be read (cannot be
written) during the import.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 64


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-50 parallel_edge


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.
● allow indicates that repetitive
edges are allowed.
● ignore indicates that
subsequent repetitive edges
are ignored.
● override indicates that the
previous repetitive edges are
overwritten.

ignore_label No Boolean Whether to ignore labels on


repetitive edges. The value is
true or false, and the default
value is true.
● true: Indicates that the
repetitive edge definition does
not contain the label. That is,
the <source vertex, target
vertex> indicates an edge,
excluding the label
information.
● false: Indicates that the
repetitive edge definition
contains the label. That is, the
<source vertex, target vertex,
label> indicates an edge.

Response Parameters
Status code: 200

Table 4-51 Response body parameters


Parameter Type Description

job_id String ID of an asynchronous job

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 65


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-52 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Incrementally import graph data. The edge file directory is testbucket/
demo_movie/edges/ and the edge data set is in CSV format. The vertex file
directory is testbucket/demo_movie/vertices/ and the vertex data set is in CSV
format.
POST http://Endpoint/v2/{project_id}/graphs/{graph_id}/import-graph

{
"edgeset_path" : "testbucket/demo_movie/edges/",
"edgeset_format" : "csv",
"vertexset_path" : "testbucket/demo_movie/vertices/",
"vertexset_format" : "csv",
"schema_path" : "testbucket/demo_movie/incremental_data_schema.xml",
"log_dir" : "testbucket/importlogdir",
"parallel_edge" : {
"action" : "override",
"ignore_label" : true
},
"delimiter" : ",",
"trim_quote" : "\"",
"offline" : false
}

Example Response
Status code: 200
Example response (successful request)
{
"job_id" : "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400


Example response for a failed request
{
"error_msg" : "parameter format error",
"error_code" : "GES.8013"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 66


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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.

4.2.8 Exporting a Graph

Function
This API is used to unbind an EIP.

NOTE

If you choose to export CSV files to your local host, the files are opened using the
spreadsheet software by default. You are advised to open the files in a text editor. If the
data contains special characters such as plus signs (+), minus signs (-), equal signs (=), and
at signs (@), the data will be parsed into formulas by the software. To ensure system
security, pay attention to the following when opening such files:
1. Do not select Enable Dynamic Data Exchange Server Launch (not recommended).
2. Do not select Enable or Yes if a dialog box indicating a security issue is displayed.

URI
POST /v2/{project_id}/graphs/{graph_id}/export-graph

Table 4-53 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 67


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-54 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-55 Request body parameters


Parameter Mandatory Type Description

graph_export_ Yes String OBS path to which a graph is


path exported

edge_set_nam Yes String Exported edge file name


e

vertex_set_na Yes String Exported vertex file name


me

schema_name Yes String Name of the exported


metadata file

paginate No paginate Pagination-related


object parameters. In version 2.3.11
or later, graphs are exported
on multiple pages by default.

Table 4-56 paginate


Parameter Mandatory Type Description

enable No Boolean Whether to enable pagination.


The default value is true. If
pagination is not required, set
this parameter to false.
NOTE
This parameter is unavailable for
database editions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 68


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

row_count_pe No Integer Maximum number of rows in


r_file each file when graphs are
exported by page. The default
value is 10000000.

num_thread No Integer Number of concurrent threads


when graphs are exported by
page. The default value is 8.

Response Parameters
Status code: 200

Table 4-57 Response body parameters


Parameter Type Description

job_id String ID of an asynchronous job

Status code: 400

Table 4-58 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Export a graph. The OBS path for exporting the graph is demo_movie/, the name
of the exported edge file is set_edge.csv, the name of the exported vertex file is
set_vertex.csv, and the name of the exported metadata file is set_schema.xml.
POST http://Endpoint/v2/{project_id}/graphs{graph_id}/export-graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 69


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"graph_export_path" : "demo_movie/",
"edge_set_name" : "set_edge.csv",
"vertex_set_name" : "set_vertex.csv",
"schema_name" : "set_schema.xml"
}

Example Response
Status code: 200

Example response for a successful request


{
"job_id" : "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Example response for a failed request


{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8011"
}

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.

4.2.9 Clearing a Graph

Function
This API is used to clear all data in a graph.

URI
POST /v2/{project_id}/graphs/{graph_id}/clear-graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 70


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-59 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_id Yes String Graph ID

Table 4-60 Query parameters


Parameter Mandatory Type Description

clear_metadat No Boolean Whether to clear graph


a metadata. Set this parameter
to true. The value can be true
or false. The default value is
false.
● true: The metadata will be
cleared.
● false: The metadata will
not be cleared.

Request Parameters

Table 4-61 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 71


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-62 Response body parameters


Parameter Type Description

job_id String ID of an asynchronous job


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

Status code: 400

Table 4-63 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Clear all data in a graph.
POST http://Endpoint/v2/{project_id}/graphs/{graph_id}/clear-graph?clear_metadata=true

{}

Example Response
Status code: 200
Example response (successful request)
{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Example response (failed request)
{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8012"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 72


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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.

4.2.10 Upgrading a Graph


Function
This API is used to upgrade a graph. The GES version is periodically upgraded. You
can upgrade your graphs as required.

URI
POST /v2/{project_id}/graphs/{graph_id}/upgrade

Table 4-64 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 73


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-65 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-66 Request body parameters


Parameter Mandatory Type Description

upgrade_versi Yes String Target version, which must be


on later than the current version

force_upgrade No Boolean Whether to upgrade forcibly.


The value is true or false, and
the default value is false.
● true: forcible upgrades,
which will interrupt running
tasks, such as long
algorithm execution tasks.
As a result, a small number
of requests may fail.
● false: non-forcible
upgrades, which will wait
for running services to
complete. The upgrade
process may be slow.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 74


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-67 Response body parameters


Parameter Type Description

job_id String ID of an asynchronous job


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

Status code: 400

Table 4-68 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Upgrade a graph to version 1.1.8 as needed.
POST http://Endpoint/v2/{project_id}/graphs{graph_id}/upgrade

{
"upgrade_version" : "1.1.8",
"force_upgrade" : false
}

Example Response
Status code: 200
Example response for a successful request
{
"job_id" : "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400


Example response for a failed request
{
"error_msg" : "graph [demo] is not found",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 75


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"error_code" : "GES.8011"
}

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.

4.2.11 Binding an EIP


Function
This API enables you to access GES by binding an elastic IP (EIP).

URI
POST /v2/{project_id}/graphs/{graph_id}/bind-eip

Table 4-69 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 76


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-70 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-71 Request body parameters


Parameter Mandatory Type Description

eip_id Yes String ID of the elastic IP address.

Response Parameters
Status code: 200
None
Status code: 400

Table 4-72 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 77


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example Request
Bind an EIP to access GES. The ID of the EIP is 02bd6dc1-5be8-430e-
a4cd-2b0f6d0bb042.
POST http://Endpoint/v2/{project_id}/graphs{graph_id}/bind-eip

{
"eip_id" : "02bd6dc1-5be8-430e-a4cd-2b0f6d0bb042"
}

Example Response
Status code: 200
Example response (successful request)
{}

Status code: 400


Example response (failed request)
{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8011"
}

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.

4.2.12 Unbinding an EIP


Function
If you do not need to use the EIP, this API enabled you to unbind the EIP to release
network resources.

URI
POST /v2/{project_id}/graphs/{graph_id}/unbind-eip

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 78


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-73 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_id Yes String Graph ID

Request Parameters

Table 4-74 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-75 Request body parameters

Parameter Mandatory Type Description

eip_id Yes String ID of the elastic IP address.

Response Parameters
Status code: 200
None
Status code: 400

Table 4-76 Response body parameters

Parameter Type Description

error_code 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 79


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

error_msg String System prompt code.


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

Example Request
Unbind an EIP to release network resources. The ID of the EIP is
02bd6dc1-5be8-430e-a4cd-2b0f6d0bb042.
POST http://Endpoint/v2/{project_id}/graphs{graph_id}/unbind-eip

{
"eip_id" : "02bd6dc1-5be8-430e-a4cd-2b0f6d0bb042"
}

Example Response
Status code: 200
Example response (successful request)
{}

Status code: 400


Example response (failed request)
{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8011"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 80


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

4.2.13 Resizing a Graph

Function
This API is used to resize a graph instance.

NOTE

After the graph is resized, you need to re-create all indexes.


Memory edition graphs deployed on a BMS cannot be resized.

URI
POST /v2/{project_id}/graphs/{graph_id}/resize

Table 4-77 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_id Yes String Graph ID

Request Parameters

Table 4-78 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-79 Request body parameter

Parameter Mandatory Type Description

resize Yes resize object Graph specifications after the


graph is resized.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 81


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-80 resize

Parameter Mandatory Type Description

graph_size_ty Yes String Graph flavor. Currently, the


pe_index value can be 2, 3, 4, or 5,
indicating 10-million-edge,
100-million-edge, 1-billion-
edge, or 10-billion-edge,
respectively.

Response Parameters
Status code: 200

Table 4-81 Response body parameters

Parameter Type Description

job_id String Indicates the ID of the resize job.


This parameter is left blank when
the request fails.
NOTE
You can view the job execution status
and obtain the return result by
querying the job ID. For details, see Job
Management APIs.

Status code: 400

Table 4-82 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 82


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example Request
Resize a graph instance. The graph size is ten-million-edge.
POST http://Endpoint/v2/{project_id}/graphs/{graph_id}/resize

{
"resize" : {
"graph_size_type_index" : "2"
}
}

Example Response
Status code: 200
Example response (successful request)
{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Example response (failed request)
{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8012"
}

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.

4.2.14 Restarting a Graph


Function
This API is used to forcibly start a graph, especially for running graphs or those are
being imported, exported, and cleared. If a graph is forcibly restarted,
asynchronous tasks of the graph are failed state and the graph is stopped and
started.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 83


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

URI
POST /v2/{project_id}/graphs/{graph_id}/restart

Table 4-83 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_id Yes String Graph ID

Request Parameters

Table 4-84 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-85 Response body parameters

Parameter Type Description

job_id String ID of a forcible restart job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 84


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-86 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Forcibly start a graph.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/restart

{}

Example Response
Status code: 200

Example response (successful request)


{
"job_id" : "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Example response (failed request)


{
"error_msg" : "The request is invalid.",
"error_code" : "GES.7016"
}

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 85


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Return Value Description

503 Service Unavailable Service unavailable

Error Code
See Error Code.

4.2.15 Expanding a Graph


Function
This API is used to expand multiple secondary nodes dynamically. The expanded
secondary nodes can process read requests, improving read performance.

NOTE

1. This API is not supported by graphs of the 10,000-edge and 10-billion-edge types.
2. Graphs cannot be resized after expansion.
3. If you want to resize and expand the graph, resize the graph before you expand it.

URI
POST /v2/{project_id}/graphs/{graph_id}/expand

Table 4-87 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 86


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-88 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-89 Request body parameter

Parameter Mandatory Type Description

expand Yes expand expand is an object.


object

Table 4-90 expand

Parameter Mandatory Type Description

replication Yes Integer Number of new nodes to


expand

Response Parameters
Status code: 200

Table 4-91 Response body parameters

Parameter Type Description

job_id String ID of the expansion job. This parameter is left


blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 87


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-92 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Expand a graph. The number of new replicas is 1.
POST http://Endpoint/v2/{project_id}/graphs/{graph_id}/expand

{
"expand":{
"replication": 1
}
}

Example Response
Status code: 200

Example response (successful request)


{
"job_id" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400

Example response (failed request)


{
"error_code" : "GES.7015",
"error_msg" : "The graph is not running or stopped."
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

403 Forbidden No operation permissions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 88


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Return Value Description

404 Not Found No resources found.

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes.

4.3 Backup Management

4.3.1 Viewing the List of All Backups

Function
This API is used to query a backup list according to search criteria. Before using
this API:

URI
GET /v2/{project_id}/graphs/backups

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

Table 4-94 Query parameters

Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 89


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-95 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-96 Response body parameters


Parameter Type Description

backup_count Integer Total number of backups. This parameter is left


blank if the request fails.

backup_list Array of List of all backups under the current project ID.
backup_list This parameter is left blank if the request fails.
objects

Table 4-97 backup_list


Parameter Type Description

id String Indicates the backup ID.

name String Backup name

backup_meth String Backup method. The value can be auto,


od manual, or import.

graph_id String ID of the graph associated with the backup

graph_name String Name of the graph associated with the backup

graph_status String Status of the graph associated with the backup

graph_size_ty String Size of the graph associated with the backup


pe_index

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 90


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

data_store_ve String Version of the graph associated with the


rsion backup

arch String CPU architecture of the graph node associated


with the backup

status String Backup status:


● backing_up: indicates that a graph is being
backed up.
● success: indicates that a graph is
successfully backed up.
● failed: indicates that a graph fails to be
backed up.

start_timesta Long Start timestamp of a backup job


mp

start_time String Start time of a backup job.

end_timestam Long End timestamp of a backup job


p

end_time String Indicates the backup end time.

size Long Backup file size (MB)

duration Long Backup duration (seconds)

Status code: 400

Table 4-98 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 91


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example Request
Query the list of all backups.
GET https://Endpoint/v2/{project_id}/graphs/backups?offset=0&limit=3

Example Response
Status code: 200
Example response (successful request)
{
"backup_count" : 3,
"backup_list" : [ {
"id" : "ada3e720-ab87-48cb-bff7-3ec5ae1a9652",
"name" : "ges060803_nodelete-20210608135513",
"backup_method" : "manual",
"graph_id" : "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graph_name" : "ges060803_nodelete",
"graph_status" : "200",
"graph_size_type_index" : "1",
"data_store_version" : "2.2.21",
"arch" : "x86_64",
"status" : "success",
"start_timestamp" : 1623160513000,
"start_time" : "2021-06-08T13:55:13",
"end_timestamp" : 1623160568000,
"end_time" : "2021-06-08T13:56:08",
"size" : 1,
"duration" : 54,
"encrypted" : false
}, {
"id" : "7ed3f51d-816d-4651-9129-fe21b64b5c91",
"name" : "ges060803_nodelete_20210609203323_auto",
"backup_method" : "auto",
"graph_id" : "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graph_name" : "ges060803_nodelete",
"graph_status" : "200",
"graph_size_type_index" : "1",
"data_store_version" : "2.2.21",
"arch" : "x86_64",
"status" : "success",
"start_timestamp" : 1623242004000,
"start_time" : "2021-06-09T12:33:24",
"end_timestamp" : 1623242004000,
"end_time" : "2021-06-09T12:33:24",
"size" : 1,
"duration" : 0,
"encrypted" : false
}, {
"id" : "604bfb46-04dd-45fc-a9ae-df24a0705b9d",
"name" : "ges060802_nodelete-20210608135523",
"backup_method" : "manual",
"graph_id" : "9b9a05c2-0cdb-41ac-b55f-93caffb0519a",
"graph_name" : "ges060802_nodelete",
"graph_status" : "400",
"graph_size_type_index" : "0",
"data_store_version" : "2.2.23",
"arch" : "x86_64",
"status" : "success",
"start_timestamp" : 1623160524000,
"start_time" : "2021-06-08T13:55:24",
"end_timestamp" : 1623160577000,
"end_time" : "2021-06-08T13:56:17",
"size" : 1,
"duration" : 53,
"encrypted" : false

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 92


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

}]
}

Status code: 400

Example response (failed request)


{
"error_code" : "GES.7006",
"error_msg" : "The underlying graph engine has internal error."
}

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.

4.3.2 Viewing the Backup List of a Graph

Function
This API is used to query the backup list of a graph.

URI
GET /v2/{project_id}/graphs/{graph_id}/backups

Table 4-99 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 93


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-100 Query parameters

Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Request Parameters

Table 4-101 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-102 Response body parameters

Parameter Type Description

backup_count Integer Total number of backups. This parameter is left


blank if the request fails.

backup_list Array of List of all backups under the current project ID.
backup_list This parameter is left blank if the request fails.
objects

Table 4-103 backup_list

Parameter Type Description

id String Backup ID

name String Backup name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 94


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

backup_meth String Backup method. The value can be auto,


od manual, or import.

graph_id String ID of the graph associated with the backup

graph_name String Name of the graph associated with the backup

graph_status String Status of the graph associated with the backup

graph_size_ty String Size of the graph associated with the backup


pe_index

data_store_ve String Version of the graph associated with the


rsion backup

arch String CPU architecture of the graph node associated


with the backup

status String Backup status:


● backing_up: indicates that a graph is being
backed up.
● success: indicates that a graph is
successfully backed up.
● failed: indicates that a graph fails to be
backed up.

start_timesta Long Start timestamp of a backup job


mp

start_time String Start time of a backup job.

end_timestam Long End timestamp of a backup job


p

end_time String Indicates the backup end time.

size Long Backup file size (MB)

duration Long Backup duration (seconds)

Status code: 400

Table 4-104 Response body parameters

Parameter Type Description

error_code 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 95


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

error_msg String System prompt code.


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

Example Request
Query the backup list of a graph.
GET https://Endpoint/v2/{project_id}/graphs/{graph_id}/backups?offset=0&limit=2

Example Response
Status code: 200
Example response (successful request)
{
"backup_count" : 2,
"backup_list" : [ {
"id" : "ada3e720-ab87-48cb-bff7-3ec5ae1a9652",
"name" : "ges060803_nodelete-20210608135513",
"backup_method" : "manual",
"graph_id" : "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graph_name" : "ges060803_nodelete",
"graph_status" : "200",
"graph_size_type_index" : "1",
"data_store_version" : "2.2.21",
"arch" : "x86_64",
"status" : "success",
"start_timestamp" : 1623160513000,
"start_time" : "2021-06-08T13:55:13",
"end_timestamp" : 1623160568000,
"end_time" : "2021-06-08T13:56:08",
"size" : 1,
"duration" : 54,
"encrypted" : false
}, {
"id" : "7ed3f51d-816d-4651-9129-fe21b64b5c91",
"name" : "ges060803_nodelete_20210609203323_auto",
"backup_method" : "auto",
"graph_id" : "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graph_name" : "ges060803_nodelete",
"graph_status" : "200",
"graph_size_type_index" : "1",
"data_store_version" : "2.2.21",
"arch" : "x86_64",
"status" : "success",
"start_timestamp" : 1623242004000,
"start_time" : "2021-06-09T12:33:24",
"end_timestamp" : 1623242004000,
"end_time" : "2021-06-09T12:33:24",
"size" : 1,
"duration" : 0,
"encrypted" : false
}]
}

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 96


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example response (failed request)


{
"error_code" : "GES.7000",
"error_msg" : "The graph does not exist or has been deleted."
}

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.

4.3.3 Adding a Backup


Function
Add a backup. If data in the current graph is incorrect or faulty, you can start the
backup graph to restore the data.

URI
POST /v2/{project_id}/graphs/{graph_id}/backups

Table 4-105 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 97


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-106 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-107 Response body parameters


Parameter Type Description

job_id String ID of the graph backup job.


NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

backup_id String Graph backup ID

Status code: 400

Table 4-108 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 98


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Example Request
Add a graph backup.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/backups

{}

Example Response
Status code: 200
Example response for a successful request
{
"job_id" : "ff8080815f9a3c84015f9a438ff70001"
"backup_id":"0000b54f-2f1d-47a5-94bc-04f0d8a2e2db"
}

Status code: 400


Example response for a failed request
{
"error_code" : "GES.7000",
"error_msg" : "The graph does not exist or has been deleted."
}

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.

4.3.4 Deleting a Backup


Function
This API is used to delete a backup.

URI
DELETE /v2/{project_id}/graphs/{graph_id}/backups/{backup_id}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 99


Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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

backup_id Yes String Graph backup ID

graph_id Yes String Graph ID

Request Parameters

Table 4-110 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200
None
Status code: 400

Table 4-111 Response body parameters


Parameter Type Description

error_code 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 100
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

error_msg String System prompt code.


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

Example Request
Delete a backup.
DELETE https://Endpoint/v2/{project_id}/graphs/{graph_id}/backups/{backupId}

Example Response
Status code: 200

Example response (successful request)


{}

Status code: 400

Example response (failed request)


{
"error_msg" : "Parameter error!",
"error_code" : "GES.0001"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 101
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

4.3.5 Exporting a Backup

Function
This API is used to export a GES graph instance backup to OBS.

URI
POST /v2/{project_id}/graphs/{graph_id}/backups/export

Table 4-112 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_id Yes String Graph ID

Request Parameters

Table 4-113 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token


Used to obtain the permission to
call APIs. For details about how to
obtain the token, see
Authentication. The value of X-
Subject-Token in the response
header is the token.

Table 4-114 Request body parameters

Parameter Mandatory Type Description

backup_id Yes String Backup ID

export_path Yes String Export path in OBS

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 102
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-115 Response body parameter

Parameter Type Description

job_id String ID of the asynchronous job

Status code: 400

Table 4-116 Response body parameters

Parameter Type Description

error_code String System prompt code


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

error_msg 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.

Example Request
Export a backup.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/backups/export
{
"backup_id": "{backup_id}",
"export_path" : "{obs_path}"
}

Example Response
Status code: 200

Example response for a successful request


{
"job_id" : "ff8080815f9a3c84015f9a438ff70001"
}

Status code: 400

Example response for a failed request


{
"error_msg" : "Parameter error!",
"error_code" : "GES.0001"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 103
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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 for Service Plane APIs.

4.3.6 Importing a Backup


Function
This API is used to import a GES graph instance backup from OBS.

URI
POST /v2/{project_id}/graphs/{graph_id}/backups/import

Table 4-117 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 104
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-118 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token


Used to obtain the permission
to call APIs. For details about
how to obtain the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-119 Request body parameter


Parameter Mandatory Type Description

import_path Yes String OBS path the backup is to be


imported from

Response Parameters
Status code: 200

Table 4-120 Response body parameter


Parameter Type Description

job_id String ID of the asynchronous job

Status code: 400

Table 4-121 Response body parameters


Parameter Type Description

error_code String System prompt code


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 105
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

error_msg 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.

Example Request
Import a backup.
POST https://Endpoint/v2/{project_id}/graphs/{graph_id}/backups/import
{
"import_path" : "{obs_path}"
}

Example Response
Status code: 200
Example response for a successful request
{
"job_id" : "ff8080815f9a3c84015f9a438ff70001"
}

Status code: 400


Example response for a failed request
{
"error_msg" : "Parameter error!",
"error_code" : "GES.0001"
}

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 for Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 106
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

4.4 Metadata Management

4.4.1 Constraints
Table 4-122 and Table 4-123 list the metadata types.

Table 4-122 Metadata property constraints


Data Type Constraints

char ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

char array ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

float ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

double ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 107
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Data Type Constraints

bool ● Equal to '='


● Not equal to '! ='

long ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

int ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

date ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

enum ● Equal to '='


● Not equal to '! ='

string ● Less than '<'


● Greater than '>'
● Equal to '='
● Not equal to '! ='
● In range 'range'
● Greater than or equal to '>='
● Less than or equal to '<='

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 108
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-123 Property-level constraints


Property Level Constraints Description

Single value/ has This property is contained.


Multiple values

Single value/ hasNot This property is not contained.


Multiple values

4.4.2 Querying the Metadata List


Function
Query the metadata list.

URI
GET /v2/{project_id}/graphs/metadatas

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

Table 4-125 Query parameters


Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 109
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-126 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-127 Response body parameters

Parameter Type Description

schema_count Integer Number of returned metadata files. This


parameter is left blank if the request fails.

schema_list Array of List of all metadata files under the current


schema_list project ID. This parameter is left blank if the
objects request fails.

Table 4-128 schema_list

Parameter Type Description

id String Metadata ID

name String Metadata name

start_time String Metadata creation time

last_update_ti String Last update time of the metadata


me

description String Metadata description

metadata_pat String Metadata path


h

status String Whether the metadata is available

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 110
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Status code: 500

Table 4-129 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Query the metadata list.
GET https://Endpoint/v2/{project_id}/graphs/metadatas?offset=0&limit=2

Example Response
Status code: 200

Example response (successful request)


{
"schema_count" : 2,
"schema_list" : [ {
"start_time" : "2022-01-21T10:13:31",
"last_update_time" : "2022-01-21T10:13:31",
"encrypted" : true,
"name" : "schema_748e",
"description" : "xxxxx",
"id" : "6634c50e-13aa-4395-8088-6b327f7da694",
"metadata_path" : "devdata/schema_748e.xml",
"status" : "200"
}, {
"start_time" : "2022-04-12T03:15:17",
"last_update_time" : "2022-11-16T08:18:32",
"encrypted" : false,
"name" : "unionsdk_schema",
"id" : "6b74069d-3cf3-4cc0-9118-2478e23b87aa",
"metadata_path" : "devdata/unionsdk/unionsdk_schema.xml",
"status" : "200"
}]
}

Status code: 500

Example response (failed request)


{
"error_code" : "GES.7006",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 111
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"error_msg" : "The underlying graph engine has internal error."


}

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.

4.4.3 Querying Metadata


Function
This API is used to query the metadata of a graph.

URI
GET /v2/{project_id}/graphs/metadatas/{metadata_id}

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

metadata_id Yes String Metadata ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 112
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-131 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-132 Response body parameters

Parameter Type Description

ges_metadata ges_metadata Object for storing metadata message


object information.

Table 4-133 ges_metadata

Parameter Type Description

labels Array of labels Label data structure set


objects

Table 4-134 labels

Parameter Type Description

name String Label name

properties Array of Property map


Map<String,String>
objects

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 113
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-135 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Query metadata of a graph.
GET https://Endpoint/v2/{project_id}/graphs/metadatas/{metadata_id}

Example Response
Status code: 200
Example response (successful request)
{
"encrypted" : false,
"ges_metadata" : {
"labels" : [ {
"name" : "friends"
}, {
"name" : "movie",
"properties" : [ {
"data_type" : "string",
"name" : "ChineseTitle",
"cardinality" : "single"
}, {
"data_type" : "int",
"name" : "Year",
"cardinality" : "single"
}, {
"data_type" : "string",
"name" : "Genres",
"cardinality" : "set"
}]
}, {
"name" : "user",
"properties" : [ {
"data_type" : "string",
"name" : "ChineseName",
"cardinality" : "single"
}, {
"type_name1" : "F",
"type_name2" : "M",
"data_type" : "enum",
"name" : "Gender",
"type_name_count" : "2",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 114
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"cardinality" : "single"
}, {
"type_name1" : "Under 18",
"type_name2" : "18-24",
"type_name3" : "25-34",
"type_name4" : "35-44",
"type_name5" : "45-49",
"type_name6" : "50-55",
"type_name7" : "56+",
"data_type" : "enum",
"name" : "Age",
"type_name_count" : "7",
"cardinality" : "single"
}, {
"data_type" : "string",
"name" : "Occupation",
"cardinality" : "single"
}, {
"data_type" : "char array",
"name" : "Zip-code",
"max_data_size" : "12",
"cardinality" : "single"
}]
}, {
"name" : "rate",
"properties" : [ {
"data_type" : "int",
"name" : "Score",
"cardinality" : "single"
}, {
"data_type" : "date",
"name" : "Datetime",
"cardinality" : "single"
}]
}]
}
}

Status code: 400


Example response (failed request)
{
"error_msg" : "6b74069d-3cf3-4cc0-9118-2478e23b87a does not exist.",
"error_code" : "GES.2067"
}

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 115
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Error Code
See Error Code.

4.4.4 Adding Metadata

Function
Add a metadata file.

URI
POST /v2/{project_id}/graphs/metadatas

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

Request Parameters

Table 4-137 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token. The token can be


obtained by calling the IAM
API. (The token is the value of
X-Subject-Token in the
response header.)

Table 4-138 Request body parameters

Parameter Mandatory Type Description

metadata_pat Yes String Path for storing the metadata


h

name Yes String Metadata name, which


contains 1 to 64 characters
consisting of only letters,
digits, and underscores (_)

description Yes String Metadata description

is_overwrite Yes Boolean Whether to overwrite the file.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 116
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Mandatory Type Description

ges_metadata Yes ges_metadat Object for storing metadata


a object message information.

Table 4-139 ges_metadata

Parameter Mandatory Type Description

labels Yes Array of Label list


labels objects

Table 4-140 labels

Parameter Mandatory Type Description

name No String Name of a label

properties No Array of Label property map


Map<String,St
ring> objects

Response Parameters
Status code: 200

Table 4-141 Response body parameters

Parameter Type Description

id String Metadata ID

name String Metadata name

Status code: 400

Table 4-142 Response body parameters

Parameter Type Description

error_code 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 117
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

error_msg String System prompt code.


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

Example Request
Add metadata. The metadata is stored in devdata/unionsdk/unionsdk_test.xml.
The metadata does not overwrite existing data, the metadata name is
unionsdk_test, and the metadata description is test.
POST https://Endpoint/v2/{project_id}/graphs/metadatas

{
"metadata_path" : "devdata/unionsdk/unionsdk_test.xml",
"is_overwrite" : false,
"name" : "unionsdk_test",
"description": " test",
"ges_metadata" : {
"labels" : [ {
"name" : "friends"
}, {
"name" : "movie",
"properties" : [ {
"dataType" : "string",
"name" : "ChineseTitle",
"cardinality" : "single"
}, {
"dataType" : "int",
"name" : "Year",
"cardinality" : "single"
}, {
"dataType" : "string",
"name" : "Genres",
"cardinality" : "set"
}]
}, {
"name" : "user",
"properties" : [ {
"dataType" : "string",
"name" : "ChineseName",
"cardinality" : "single"
}, {
"typeName1" : "F",
"typeName2" : "M",
"typeNameCount" : "2",
"dataType" : "enum",
"name" : "Gender",
"cardinality" : "single"
}, {
"typeName1" : "Under 18",
"typeName2" : "18-24",
"typeName3" : "25-34",
"typeName4" : "35-44",
"typeNameCount" : "7",
"dataType" : "enum",
"name" : "Age",
"typeName5" : "45-49",
"typeName6" : "50-55",
"cardinality" : "single",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 118
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"typeName7" : "56+"
}, {
"dataType" : "string",
"name" : "Occupation",
"cardinality" : "single"
}, {
"dataType" : "char array",
"name" : "Zip-code",
"maxDataSize" : "12",
"cardinality" : "single"
}]
}, {
"name" : "rate",
"properties" : [ {
"dataType" : "int",
"name" : "Score",
"cardinality" : "single"
}, {
"dataType" : "date",
"name" : "Datetime",
"cardinality" : "single"
}]
}]
}
}

Example Response
Status code: 200

Example response (successful request)


{
"id" : "ff8080815f9a3c84015f9a438ff70001",
"name" : "movie_schema"
}

Status code: 400

Example response (failed request)


{
"error_msg" : "The metadata file already exists.",
"error_code" : "GES.2067"
}

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 119
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Error Code
See Error Code.

4.4.5 Deleting Metadata

Function
Delete a metadata file.

URI
DELETE /v2/{project_id}/graphs/metadatas/{metadata_id}

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

metadata_id Yes String Metadata ID

Request Parameters

Table 4-144 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 400

None

Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 120
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-145 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Delete metadata of a graph.
DELETE /v2/{project_id}/graphs/metadatas/{metadata_id}

Example Response
Status code: 200

OK
{}

Status code: 400

Bad Request
{
"error_code" : "GES.7024",
"error_msg" : "The metadata is not exist or has been deleted."
}

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 121
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Error Code
See Error Code.

4.4.6 Importing Metadata from OBS


Function
This API is used to import metadata from OBS.

URI
POST /v2/{project_id}/graphs/metadata/upload-from-obs

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

Request Parameters

Table 4-147 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token. The token can be


obtained by calling the IAM
API. (The token is the value of
X-Subject-Token in the
response header.)

Table 4-148 Request body parameters

Parameter Mandatory Type Description

metadata_pat Yes String Path for storing the metadata


h

name Yes String Metadata name

description No String Metadata description

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 122
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-149 Response body parameters

Parameter Type Description

id String Metadata ID

name String Metadata name

Status code: 400

Table 4-150 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Import metadata from OBS. The metadata is stored in devdata/unionsdk/
schema.xml and the metadata name is test_schema.
POST https://Endpoint/v2/{project_id}/graphs/metadata/upload-from-obs

{
"metadata_path" : "devdata/unionsdk/schema.xml",
"name" : "test_schema",
"description" : "xx"
}

Example Response
Status code: 200

Example response for a successful request


{
"id" : "d30d2e94-f2ee-4344-af49-eb27fd002eea",
"name" : "test_schema"
}

Status code: 400

Example response for failed request

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 123
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

{
"error_msg" : "test_schema The name already exists.",
"error_code" : "GES.2067"
}

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.

4.5 Task Center

4.5.1 Querying Job Status on the Management Plane


Function
This interface is used to query the execution status of a task, such as ECS creation,
ECS deletion, ECS batch operation, and NIC operation. Asynchronous APIs that are
used to create, stop, start, delete, and import graphs will return job IDs after
commands are sent. You can query the job execution status according to the job
IDs.

URI
GET /v2/{project_id}/graphs/{graph_id}/jobs/{job_id}/status

Table 4-151 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_id Yes String Graph ID

job_id Yes String ID of the asynchronous job

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 124
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-152 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-153 Response body parameters

Parameter Type Description

job_id String Job ID

status String The task status.


● pending
● running
● success
● failed

job_type String Task type.

job_name String Task name

related_graph String Associated graph name

begin_time String Job start time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

end_time String Job end time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

job_detail job_detail This parameter is returned only when


object jobName is set to ImportGraph and is used to
display graph import details.

fail_reason String Job failure cause

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 125
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

job_progress Double Job execution progress. It is a reserved field,


and not used currently.

Table 4-154 job_detail


Parameter Type Description

schema_path Array of Path for storing metadata


schema_path
objects

edgeset_path Array of Path for storing the edge data set


edgeset_path
objects

vertexset_pat Array of Path for storing the vertex data set


h vertexset_pat
h objects

Table 4-155 schema_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 126
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-156 edgeset_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Table 4-157 vertexset_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 127
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Status code: 400

Table 4-158 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Query the execution status of a job.
GET https://Endpoint/v2/{project_id}/graphs/{graph_id}/jobs/{job_id}/status

Example Response
Status code: 200

Example response (successful request)


{
"job_id" : "ff80808167f09aaa0167f19b35ec0305",
"status" : "success",
"job_type" : "GraphManagement",
"job_name" : "ImportGraph",
"related_graph" : "GES_UI_AUTO",
"begin_time" : "2018-11-27T21:39:00",
"end_time" : "2018-11-27T21:39:56",
"job_detail" : {
"vertexset_path" : [ {
"path" : "ges-ui/auDatas/list_set_vertex.csv",
"log" : null,
"cause" : null,
"status" : "success"
} ],
"edgeset_path" : [ {
"path" : "ges-ui/auDatas/list_set_edge.csv",
"log" : null,
"cause" : null,
"status" : "success"
} ],
"schema_path" : [ {
"path" : "ges-ui/auDatas/list_set_schema.xml",
"log" : null,
"cause" : null,
"status" : "success"
}]
},

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 128
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"job_progress" : 0
}

Status code: 400

Example response (failed request)


{
"error_msg" : "can not find job, jobId is ff808081646e81d40164c5fb414b2b1a1",
"error_code" : "GES.8301"
}

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.

4.5.2 Querying Job Details in the Job Center

Function
This API is used to query asynchronous job details in the job center on the
management plane. Asynchronous jobs include creating, closing, starting, deleting,
adding, importing, exporting, and upgrading graphs, as well as adding backups.

URI
GET /v2/{project_id}/graphs/jobs

Table 4-159 URI parameters

Parameter Mandatory Type Description

project_id Yes String Project ID, which is used for


resource isolation.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 129
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-160 Query parameters


Parameter Mandatory Type Description

end_time No String Job end date. Currently, only


the date is supported. The
format is yyyy-MM-dd, for
example, 2019-03-27.

graph_name No String Associated graph name

limit No String Maximum number of


resources displayed on a single
page. The default value is 10.

offset No String Start position of the request.


The default value is 0.

start_time No String Job start date. Currently, only


the date is supported. The
format is yyyy-MM-dd, for
example, 2019-03-27.

status No String The task status. Options:


● running
● waiting
● success
● failed

Request Parameters

Table 4-161 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 130
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-162 Response body parameters


Parameter Type Description

job_count Integer Total number of jobs

job_list Array of Task list


job_list
objects

Table 4-163 job_list


Parameter Type Description

job_id String Job ID

status String The task status.


● pending
● running
● success
● failed

job_type String Task type.

job_name String Task name

related_graph String Associated graph name

begin_time String Job start time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

end_time String Job end time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

job_detail job_detail This parameter is returned only when


object jobName is set to ImportGraph and is used to
display graph import details.

fail_reason String Job failure cause

job_progress Double Job execution progress. It is a reserved field,


and not used currently.

Table 4-164 job_detail


Parameter Type Description

schema_path Array of Path for storing metadata


schema_path
objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 131
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

edgeset_path Array of Path for storing the edge data set


edgeset_path
objects

vertexset_pat Array of Path for storing the vertex data set


h vertexset_pat
h objects

Table 4-165 schema_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Table 4-166 edgeset_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 132
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Table 4-167 vertexset_path


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

total_lines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failed_lines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successful_lin Long Number of lines that are successfully imported.


es The value -1 indicates that this field is not
returned in the current version.

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 133
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-168 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt code.


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

Example Request
Query asynchronous job details in the job center on the management plane.
GET https://Endpoint/v2/{project_id}/graphs/jobs?offset=0&limit=100

Example Response
Status code: 200
Example response (successful request)
{
"job_count" : 2,
"job_list" : [ {
"job_id" : "ff80808167bb90340167bc3c7b5b026a",
"status" : "success",
"job_type" : "GraphManagement",
"job_name" : "ImportGraph",
"related_graph" : "test1217",
"begin_time" : "2018-12-17T12:55:40",
"end_time" : "2018-12-17T12:56:32",
"job_detail" : {
"vertexset_path" : null,
"edgeset_path" : [ {
"path" : "hkmovie/edge.csv",
"log" : null,
"cause" : null,
"status" : "success"
} ],
"schema_path" : [ {
"path" : "hkmovie/schema.xml",
"log" : null,
"cause" : null,
"status" : "success"
}]
},
"job_progress" : 0
}, {
"job_id" : "ff80808167bb90340167bc5d0b1d0358",
"status" : "success",
"job_type" : "GraphManagement",
"job_name" : "DeleteGraph",
"related_graph" : "test1218",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 134
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"begin_time" : "2018-12-17T13:31:14",
"end_time" : "2018-12-17T13:34:48",
"job_progress" : 0
}]
}

Status code: 400


Example response (failed request)
{
"error_msg" : "failed",
"error_code" : "GES.9999"
}

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.

4.6 Plugin Management

4.6.1 Querying Scene Analysis Plugin Information


Function
This API is used to query the information about the application analysis capability
in a scene, including information about the applications, parameters, and function
details.

URI
GET /v2/{project_id}/graphs/scenes

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 135
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

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

Table 4-170 Query parameters


Parameter Mandatory Type Description

scene_name No String Scene name. If only


scene_name is specified, all
application details in the
specified scene will be
returned. If only scene_name
and application_name are
specified, details about the
applications requested by
application_name will be
returned. If scene_name,
application_name, and
graph_id are left empty,
details of all scene
applications will be returned.

application_n No String Application name. If only


ame scene_name and
application_name are
specified, details about the
applications requested by
application_name will be
returned. If scene_name,
application_name, and
graph_id are left empty,
details of all scene
applications will be returned.

graph_id No String Graph ID. If only graph_id is


set, details about all the
subscribed applications of the
graph ID will be returned. If
scene_name,
application_name, and
graph_id are left empty,
details of all scene
applications will be returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 136
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-171 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 4-172 Response body parameters


Parameter Type Description

results Array of Scene analysis plugin information


results
objects

Table 4-173 results


Parameter Type Description

scene String Scene name

name String Application name

params Array of Parameter list


params
objects

description String Description of an application in a scene

Table 4-174 params


Parameter Type Description

name String Parameter name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 137
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Parameter Type Description

type String Parameter type. The value range is


["string","int"]. Currently, only "string" is
supported.

default_value String The value can be left empty or a specified


value. If you left the value empty, the
parameter is not nullable.

Status code: 400

Table 4-175 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt.


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

Example Request
Query the information about the application analysis capability in a scene.
GET /v2/{project_id}/graphs/scenes?scene_name=xxx&application_name=xxx&graph_id=xxx

Example Response
Status code: 200
Example response (successful request)
{
"results" : [ {
"name" : "movie_recommendation",
"description": "Recommend movies that friends are interested in. Graph constraints: (user)-[friends]-
>(user), (user)-[rates]->(movie)",
"params" : [ {
"name" : "user",
"default_value" : "",
"type" : "string"
} ],
"scene" : "MovieSocialNetwork_V2"
}, {
"name" : "friend_recommendation",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 138
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"description": "Recommend people who you may be interested in (considering the relationships between
potential friends and movie preference). Graph constraints: (user) -[friends]-> (user), (user) -[rates]->
(movie)",
"params" : [ {
"name" : "user",
"default_value" : "",
"type" : "string"
} ],
"scene" : "MovieSocialNetwork_V2"
}]
}

Status code: 400

Example response (failed request)


{
"error_msg" : "The request body or header is invalid.",
"error_code" : "GES.7016"
}

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.

4.6.2 Subscribing to a Scene Analysis Plugin

Function
This API is used to subscribe to a scene analysis plugin so that you can use the
function through the service plane APIs.

NOTE

A subscribed plugin cannot be subscribed to repeatedly. To update the plugin, cancel the
subscription and subscribe to it again after update.

URI
POST /v2/{project_id}/graphs/{graph_id}/scenes/register

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 139
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-176 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_id Yes String Graph ID

Request Parameters

Table 4-177 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-178 Request body parameters

Parameter Mandatory Type Description

scenes No Array of Scene you want to subscribe


scenes to
objects

Table 4-179 scenes

Parameter Mandatory Type Description

name No String Scene name

applications No Array of List of applications you want


strings to subscribe to (not supported
currently).

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 140
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-180 Response body parameters


Parameter Type Description

result String Subscription result

Status code: 400

Table 4-181 Response body parameters


Parameter Type Description

error_code 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.

error_msg String System prompt.


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

Example Request
Subscribe to an application scenario analysis plugin. The scenario name is Service
ticket association analysis, and the list of applications is In-depth analysis of
dynamic high-dimension relationships.
POST /v2/{project_id}/graphs/{graph_id}/scenes/register

{
"scenes" : [ {
"name": "Service ticket association analysis",
"applications": ["In-depth analysis of dynamic high-dimension relationships"]
}]
}

Example Response
Status code: 200
Example response (successful request)
{
"result" : "success"
}

Status code: 400


Example response (failed request)
{
"error_msg" : "graph [demo] is not found",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 141
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

"error_code" : "GES.8402"
}

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.

4.6.3 Unsubscribing from a Scene Analysis Plugin


Function
This API is used to unsubscribe from a scene analysis plugin. After the subscription
is canceled, you cannot use the function through application service plane APIs.

URI
POST /v2/{project_id}/graphs/{graph_id}/scenes/unregister

Table 4-182 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 142
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Request Parameters

Table 4-183 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 4-184 Request body parameters


Parameter Mandatory Type Description

scenes No Array of List of scenes you want to


scenes unsubscribe from
objects

Table 4-185 scenes


Parameter Mandatory Type Description

name No String Scene name

applications No Array of List of applications you want


strings to unsubscribe from

Response Parameters
Status code: 200

Table 4-186 Response body parameters


Parameter Type Description

success Array of Scene application that is successfully


strings unsubscribed from

failure Array of Scene application that fails to be unsubscribed


strings from

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 143
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Table 4-187 Response body parameters

Parameter Type Description

error_code 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.

error_msg String System prompt.


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

Example Request
Unsubscribe from a scenario analysis plugin. The scenario name is Service ticket
association analysis, and the list of applications is In-depth analysis of dynamic
high-dimension relationships.
POST /v2/{project_id}/graphs/{graph_id}/scenes/unregister

{
"scenes" : [ {
"name": "Service ticket association analysis",
"applications": ["In-depth analysis of dynamic high-dimension relationships"]
}]
}

Example Response
Status code: 200

Example response (successful request)


{
"success" : [ "testCase" ],
"failure" : [ "xxx" ]
}

Status code: 400

Example response (failed request)


{
"error_msg" : "graph [demo] is not found",
"error_code" : "GES.8402"
}

Status Code
Return Value Description

400 Bad Request Request error

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 144
Graph Engine Service(GES)
API Reference 4 Management Plane APIs (V2)

Return Value Description

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 145
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5 Service Plane APIs

5.1 Memory Edition

5.1.1 Vertex Operation APIs

5.1.1.1 Querying Vertices Based on Filter Criteria

Function
This API is used to query vertices that meet filter criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=query

Table 5-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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 146
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-2 Request body parameters


Parameter Mandatory Type Description

labels Either labels or Strin Filter criteria of the vertex


vertexFilters is g type
mandatory.

vertexFilters Either labels or Obje Filter criteria, in


vertexFilters is ct JSONArray format.
mandatory. Vertices are filtered by
property.

offset No Integ Start position of the


er request

limit No Integ Maximum number of


er resources displayed on a
single page. The default
value is 10.

sorts No Obje Result sorting property, in


ct JSONArray format

Table 5-3 sorts parameter description


Parameter Mandatory Type Description

key Either Key or String Possible values are id, label, and
propertyName is property. These values indicate that
mandatory. IDs, labels, or properties are sorted.

propertyN Either Key or String Property name


ame propertyName is
mandatory.

orderValue No String Possible values are incr and decr,


which indicate ascending and
descending order respectively. The
default value is incr.

Table 5-4 vertexFilters parameter structure


Paramete Mandatory Type Description
r

propertyN Yes String Property name


ame

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 147
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Mandatory Type Description


r

predicate Yes String Predicate. Available values are =, <,


>, <=, >=, range, has, hasNot,
full_text_match, full_text_prefix,
full_text_wildcard,
full_text_regexp, full_text_fuzzy,
and full_text_combination.
NOTE
If the property is of the composite type,
such as list or set, the predicate can only
be has or hasNot.

values No String Property value. If predicate is


full_text_combination, values
cannot be a string. For details, see
Example 2 for vertexFilters
(full_text_combination).

type No String Logical operator of the filter criteria.


Possible values are and and or. The
default value is and.

Response Parameters

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

jobId String ID of the vertex query job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain
the return result by querying the job ID. For
details, see Querying Job Status on the Service
Plane.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 148
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

jobType Integer Job type. This parameter is left blank if the


request fails.

Example Request
Query vertices that meet filter criteria. The start position of the request is 0, the
maximum number of resources on each page is 2, the attribute criteria for filtering
are movie and user, and the attribute name for filtering is Age.
POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=query

{
"offset":0,
"limit":2,
"labels": ["movies",
"user"],
"vertexFilters":[{
"propertyName":"Age",
"predicate":"=",
"values":["18-24"]
}
]
}

NOTE

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

Example 1 for vertexFilters


[
{
"propertyName":"Gender",
"predicate":"=",
"values":["F"]
},
{
"propertyName":"Age",
"predicate":"range",
"values":["18-24","56+"],
"type":"or"
}
]

Example 2 for vertexFilters, with predicate set to full_text_combination


"vertexFilters": [
{
"propertyName": "propertyName",
"predicate": "full_text_combination",
"values": [
{
"propertyName": "movieid",
"value": "0"
},
{
"propertyName": "title",
"value": "american"
}
]
}
]

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 149
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

When predicate is set to full_text_match, full_text_prefix, full_text_wildcard,


full_text_regexp, full_text_fuzzy, or full_text_combination, the vertexFilters list can
contain only one element, that is, multi-layer filters are not allowed. The labels parameter
cannot be used at the same time. When predicate is full_text_combination, set the
outermost propertyName to propertyName. In this case, the values parameter is not a
simple string list. Each element of the values list has two members: propertyName and
value. To use the full-text index, you need to call the API for creating a full-text index first.

Example Response
Status code: 200
Example of a successful response
Http Status Code: 200
{
"jobId": "03e774f5-29ea-4187-9508-5435f3892ead016886200",
"jobType": 1
}

Status code: 400


Example of a failed response
Http Status Code: 400
{
"errorMessage": "Bad Request, parameter labels and vertexFilters cannot all be null",
"errorCode": "GES.8203"
}

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.

5.1.1.2 Querying Vertex Details

Function
This API is used to query the vertex information (such as the label and property)
based on the vertex ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 150
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/detail?
vertexIds={vertex_ids}

Table 5-6 URI parameters

Paramet Mandato Type Description


er ry

project_i Yes String Project ID. For details about how to obtain
d the project ID, see Obtaining a Project ID.

graph_n Yes String Graph name


ame

vertex_id Yes String IDs of the vertices to be queried. When


s multiple IDs are specified by vertexIds,
separate the IDs with commas (,) in the URL.

Request Parameters

Table 5-7 Request body parameter

Parameter Type Description

data List Vertex details. For details, see Table 5-8.

Table 5-8 data parameter description

Parameter Type Description

vertices List Vertex result set. If no


corresponding vertices are found,
the value of vertices is empty.

Response Parameters

Table 5-9 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 151
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

data Object Query results.

Example Request
Query node information by node ID and return node details.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/detail?vertexIds=Ray

NOTE

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

Example Response
Status code: 200
Example of a successful response
Http Status Code: 200
{
"data": {
"vertices": [
{
"id": "Ray",
"label": "user",
"properties": {
"Occupation": [
"college/grad student"
],
"Name": [
"Lei"
],
"Zip-code": [
"90241"
],
"Gender": [
"M"
],
"Age": [
"18-24"
]
}
}
]
}
}

Status code: 400


Example of a failed response
Http Status Code: 400
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 152
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"errorMessage":"graph [demo] is not found",


"errorCode":"GES.8204"
}

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.

5.1.1.3 Adding a Vertex

Function
This API is used to add a vertex.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices

Table 5-10 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 153
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-11 Request body parameters

Paramet Mandatory Type Description


er

vertex Yes String Vertex name

label Yes String Label of a vertex. If no label


exists, set it to __DEFAULT__.

propertie No Json Value of each property


s

Response Parameters

Table 5-12 Parameter description

Parameter Type Description

errorMessag String System prompt.


e ● 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 Request
Add a vertex named Lily and set the vertex label to user.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices
{
"vertex":"Lily",
"label":"user",
"properties":{
"Age":[
"under 18"
],
"Gender":[
"F"
],

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 154
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"Occupation":[
"artist"
],
"Zip-code":[
"98133"
]
}
}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "vertex [Lily] already exists",
"errorCode": "GES.8000"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.1.4 Deleting a Vertex

Function
This API is used to delete a vertex.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 155
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/{vertex_id}

Table 5-13 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

vertex_id Yes String Vertex ID

Response Parameters

Table 5-14 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 Request
Delete a vertex.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/Lily

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 156
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "vertex [Lily] does not exist",
"errorCode": "GES.8000"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.1.5 Updating a Vertex Property

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

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/{vertex_id}/properties/
action?action_id={actionId}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 157
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-15 URI parameters


Parame Mandatory Type Description
ter

project_i Yes String Project ID. For details about how to obtain
d the project ID, see Obtaining a Project ID.

graph_n Yes String Graph name


ame

vertex_i Yes String Vertex ID


d

actionId Yes String Operator. Possible values:


● UPDATE: Update the value of a property.
● ADD: Add the value to a property. 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.

Request Parameters

Table 5-16 Request body parameters


Parameter Mandatory Type Description

properties Yes Object Value of each property

label No String Name of a label

Response Parameters

Table 5-17 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 158
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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 Request
Update the property value of a vertex. The value of the Age property is under 18,
and the value of the Gender property is F.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/Lily/properties/action?
action_id={actionId}
{
"properties":{

"Age":[
"under 18"
],
"Gender":[
"F"
]
}
}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "vertex [Lily] does not exist",
"errorCode": "GES.8220"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 159
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.1.6 Querying Vertices in Batches

Function
This API is used to query the vertex data (such as the labels and properties) in
batches based on the vertex IDs.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?
action_id=batch-query

Table 5-18 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 160
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-19 Request body parameters


Paramet Mandator Type Description
er y

vertices Yes List Vertex IDs you use to query the vertices

Response Parameters

Table 5-20 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

data Object The data field is contained when the query is


successful, and the data field contains the vertices
query result.

result String Query results. If the request is successful, the


value is success. If the request fails, the value is
failed.

Example Request
Query nodes in batches by node ID. The vertex IDs to be queried are
27003509_Station Building and 39636392_Badaling Great Wall.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-
query
{
"vertices":
["27003509_Station Building",
"39636392_Badaling Great Wall"]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 161
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"data": {
"vertices": [
{
"id": "27003509_Station Building",
"label": "tag",
"properties": {
"popularity": [
0
],
"name": [
"Station Building"
],
"alias": [
"Guanghua Road Office",
"Headquarters",
"Giant Underpants",
"Headquarters Building"
]
}
},
{
"id": "39636392_Badaling Great Wall",
"label": "tag",
"properties": {
"popularity": [
0
],
"name": [
"Badaling Great Wall"
],
"alias": [
"Great Wall"
]
}
}
]
}
"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": " Bad Request, parameter vertices cannot be null",
"errorCode": "GES.8214"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 162
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

403 Forbidden No operation permission.

404 Not Found No resources found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.1.7 Adding Vertices in Batches

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 5-21 URI parameters

Parameter Mandato Type Description


ry

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 5-22 Request body parameters

Parameter Mandatory Type Description

vertices Yes List Vertices you want to add. A


maximum of 10,000 vertices can
be added at a time. For details
about this array, see the vertices
parameters.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 163
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

overrideExi No Boolean Whether to overwrite the existing


sts 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 5-23 vertices parameter description


Param Manda Type Description
eter tory

vertex Yes Strin Vertex ID


g

label Yes Strin Vertex label


g

propert No JSON Value of each property


ies

Response Parameters

Table 5-24 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 164
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

result String Request result. If the request is successful, the


value is success. If the request fails, the value is
failed.

Example Request
Add vertices in batches. The names of the vertices to be added 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
}

NOTE

● 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 (successful request)


Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 165
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "vertex [Lily] already exists",
"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.

5.1.1.8 Deleting Vertices in Batches

Function
This API is used to delete vertices in batches based on the vertex IDs.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?
action_id=batch-delete

Table 5-25 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 166
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-26 Request body parameters

Param Manda Type Description


eter tory

vertices Yes Strin Vertex ID array to be deleted


g

Response Parameters

Table 5-27 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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 Request
Delete nodes in batches by node ID. The vertex IDs to be deleted are Vivian and
46.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-
delete
{
"vertices": [
"Vivian",
"46"
]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 167
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": " Bad Request, parameter vertices cannot be null",
"errorCode": "GES.8214"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found No resources found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.1.9 Updating Vertex Properties in Batches

Function
This API is used to update vertex properties in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/properties/action?
action_id={actionId}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 168
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-28 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:


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

Request Parameters

Table 5-29 Request body parameters


Parameter Mandatory Type Description

vertices Yes Json Vertex array to be updated For


details about this array, see the
vertices parameters.

ignoreErro No Boolean Whether to ignore the update


r error of specific vertices. The
default value is false.
● The value false indicates that
if an error that causes the
update failure is detected, for
example, the vertex to be
updated does not exist, an
error is reported and no vertex
will be updated.
● The value true indicates that
similar errors will be ignored
and other vertex properties
without errors will be updated.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 169
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-30 vertices parameter description


Param Manda Type Description
eter tory

vertex Yes Strin Vertex ID


g

label No Strin Vertex label


g

propert Yes Json Value of each property to be updated


ies

Response Parameters

Table 5-31 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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 Request
Update vertex properties in batches. The vertex names to be updated are 150 and
6.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/properties/action?
action_id=batch-update
{
"vertices": [
{
"vertex": "150",
"label": "movie",
"properties": {
"movieid": [
"150"
],
"title": [

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 170
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"testmoive"
],
"genres": [
"Comedy"
]
}
},
{
"vertex": "6",
"properties": {
"title": [
"testmoive_exist_id"
],
"genres": [
"Comedy"
]
}
}
],
"ignoreError": true

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"vertex [Lily] does not exist",
"errorCode":"GES.8220"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 171
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Code
See Error Code.

5.1.1.10 Adding a Vertex Label

Function
This API is used to add a vertex label.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/{vertex_id}/labels

Table 5-32 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

vertex_id Yes String Vertex ID

Request Parameters

Table 5-33 Request body parameter

Parameter Mandatory Type Description

label Yes String Vertex label

Response Parameters

Table 5-34 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 172
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

Example Request
Add a vertex label named user.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/{vertex_id}/labels
{
"label":"user"
}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "Same label [user] already exists",
"errorCode": "GES.8213"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 173
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Code
See Error Code.

5.1.1.11 Deleting a Vertex Label

Function
This API is used to delete a vertex label.

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/{vertex_id}/labels/
{label_name}

Table 5-35 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

vertex_id Yes String Vertex ID

label_name Yes String Vertex label

Response Parameters

Table 5-36 Response body parameters

Paramete Type Description


r

errorMess String System prompt.


age ● 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 174
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Type Description


r

result String Request result. If the request is successful, the value is


success. If the request fails, the value is failed.

Example Request
Delete a vertex label.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/46/labels/movie

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "Vertex [46] does not have label [movie]",
"errorCode": "GES.8182"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 175
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.1.12 Exporting Filtered Vertices

Function
This API is used to export the vertex set that meets the filter criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=export

Table 5-37 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_na Yes String Graph name


me

Example Request
Export vertices that meet filter criteria (only the asynchronous mode is supported).
The export path is demo_movie/, and the export file name is
export_movie_and_user.csv.
POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=export
{
"labels": [
"movies",
"user"
],
"vertexFilters": [
{
"propertyName": "Age",
"predicate": "=",
"values": [
"18-24"
]
}
],
"exportPath": "demo_movie/",
"fileName": "export_movie_and_user.csv",
"obsParameters": {
"accessKey": "XXXX",
"secretKey": "XXXX"
}
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 176
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-38 Request body parameters


Parameter Mandatory Typ Description
e

labels Either labels or Strin Filter criteria of the vertex type


vertexFilters is g
mandatory.

vertexFilters Either labels or Json Filter criteria, in JSONArray


vertexFilters is format. Vertices are filtered by
mandatory. property. For details, see
vertexFilters parameters.

exportPath Yes Strin Export path


g

fileName No Strin Name of the exported file


g

obsParamet Yes Strin OBS authentication parameters.


ers g For details, see obsParameters.

Table 5-39 vertexFilters parameters


Paramete Mandatory Type Description
r

propertyN Yes String Property name


ame

predicate Yes String Predicate. Available values are =, <,


>, <=, >=, range, has, hasNot,
full_text_match, full_text_prefix,
full_text_wildcard,
full_text_regexp, full_text_fuzzy,
and full_text_combination.

values No String Property value. If predicate is


full_text_combination, the value
cannot be a string.

type No String Logical operator of the filter criteria.


Possible values are and and or. The
default value is and.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 177
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-40 obsParameters parameter description


Parameter Mandator Type Description
y

accessKey Yes string AK

secretKey Yes string SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Response Parameters

Table 5-41 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

jobId String ID of the edge query job


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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "03e774f5-29ea-4187-9508-5435f3892ead016886200",
"jobType": 1
}

Status code: 400


Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 178
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "Bad Request, parameter labels and vertexFilters cannot all be null",
"errorCode": "GES.8203"
}

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.

5.1.1.13 Deleting Filtered Vertices

Function
This API is used to delete the vertex set that meets the filter criteria.

Table 5-42 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_na Yes String Graph name


me

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=delete

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 179
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-43 Request body parameters


Parame Mandatory Type Description
ter

labels Either labels or String Filter criteria of the vertex type


vertexFilters is
mandatory.

vertexFil Either labels or Object Filter criteria, in JSONArray


ters vertexFilters is format. Vertices are filtered by
mandatory. property.
For details, see vertexFilters
parameters.

Table 5-44 vertexFilters parameters


Paramete Mandatory Type Description
r

propertyN Yes String Property name


ame

predicate Yes String Predicate. Available values are =, <,


>, <=, >=, range, has, hasNot,
full_text_match, full_text_prefix,
full_text_wildcard,
full_text_regexp, full_text_fuzzy,
and full_text_combination.

values No String Property value. If predicate is


full_text_combination, the value
cannot be a string.

type No String Logical operator of the filter criteria.


Possible values are and and or. The
default value is and.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 180
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-45 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.

jobId String ID of the vertex query job. This parameter is left blank
when the request fails.
NOTE
You can view the job execution status and obtain the return result
by querying the job ID. For details, see Querying Job Status on
the Service Plane.

Example Request
Delete vertices that meet filter criteria (only the asynchronous mode is supported).
The vertex type filter criteria are movies and user, and the property name is Age.
POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=delete
{
"labels": [
"movies",
"user"
],
"vertexFilters": [
{
"propertyName": "Age",
"predicate": "=",
"values": [
"18-24"
]
}
]
}

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "03e774f5-29ea-4187-9508-5435f3892ead016886200",
"jobType": 1
}

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 181
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "Bad Request, parameter labels and vertexFilters cannot all be null",
"errorCode": "GES.8203"
}

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.

5.1.2 Edge Operation APIs

5.1.2.1 Querying Edges Based on Filter Criteria

Function
This API is used to query edges that meet filter criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=query

Table 5-46 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 182
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-47 Request body parameters


Paramet Mandatory Type Description
er

labels Either labels or String Filter criteria of the


edgeFilters is relationship type
mandatory.

edgeFilte Either labels or String Filter criteria, in JSONArray


rs edgeFilters is format. Vertices are filtered by
mandatory. property.

offset No Integer Start position of the request

limit No Integer Expected number of edges


returned by a query

sorts No Object Result sorting property.


It is in JSONArray format.

Table 5-48 sorts parameter description


Parameter Mandatory Type Description

key Either Key or String Possible values are label and


propertyName property, which indicate that labels
is mandatory. or properties are sorted.

propertyNa Either Key or String Property name


me propertyName
is mandatory.

orderValue No String Possible values are incr and decr,


which indicate ascending and
descending order respectively. The
default value is incr.

Table 5-49 edgeFilters parameter structure


Parame Mandatory Type Description
ter

property Yes String Property name


Name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 183
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parame Mandatory Type Description


ter

predicat Yes String Logical relationship. Possible values are =, <, >,
e <=, >=, range, has, hasNot, full_text_match,
full_text_prefix, full_text_wildcard,
full_text_regexp, full_text_fuzzy, and
full_text_combination.
NOTE
If the property is of the composite type, such as list
or set, the predicate can only be has or hasNot.

values No String Property value. When predicate is


full_text_combination, values cannot be a
string. For details, see the following note.

type No String Logical relationship of filter criteria. Possible


values are and and or. The default value is
and.

NOTE

When predicate is set to full_text_match, full_text_prefix, full_text_wildcard,


full_text_regexp, full_text_fuzzy, or full_text_combination, the edgeFilters list can
contain only one element, that is, multi-layer filters are not allowed. The labels parameter
cannot be used at the same time. When predicate is full_text_combination, set the
outermost propertyName to propertyName. In this case, the values parameter is not a
simple string list. Each element of the values list has two members: propertyName and
value. To use the full-text index, you need to call the API for creating a full-text index first.

Response Parameters

Table 5-50 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 184
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

jobId String ID of the edge query job


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

Example Request
Query edges that meet filter criteria. The start position of the request is 0, the
number of edges to be returned is 20, and the filter criterion of the relationship
type is rate.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=query
{
"offset":"0",
"limit":"20",
"labels":[
"rate"
],
"edgeFilters":[
{
"propertyName":"Score",
"predicate":">=",
"values":[
"2"
]
},
{
"propertyName":"Datetime",
"predicate":"range",
"values":[
"1998-12-27 01:00:00",
"2000-12-31 00:12:38"
],
"type":"or"
}
]
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "f9987cab-64d3-4b3d-ac43-e91ae0c21bef168127124",
"jobType": 0
}

Status code: 400

Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 185
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "Bad Request, parameter labels and edgeFilters cannot all be null",
"errorCode": "GES.8103"
}

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.

5.1.2.2 Querying Edge Details

Function
This API is used to query the detailed information about an edge based on the
source vertex, target vertex, and index of the edge. Information about edges and
properties is returned.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/edges/detail?
source={sourceVertex}&target={targetVertex}&index={index}

Table 5-51 URI parameters


Parameter Manda Type Description
tory

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 186
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-52 Request body 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

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, all edges
between the
source and target
vertices are
queried

Response Parameters

Table 5-53 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

data Object Query results. If the query is successful, the query


result will be returned. If the query fails, this
parameter will be left blank.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 187
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-54 data parameter


Paramete Mandato Type Description
r ry

edges Yes List Edge result set. If no edge is found, this


parameter will be left blank.

Example Request
Query details about an edge.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/detail?
source=Ray&target=Rocky&index=6

NOTE

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

Example Response
Status code: 200
Example successful response
Http Status Code: 200

{
"data": {
"edges": [
{
"index": "6",
"source": "Ray",
"label": "rate",
"properties": {
"Score": [
3
],
"Datetime": [
"2000-11-22 19:23:05"
]
},
"target": "Rocky"
}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8107"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 188
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.1.2.3 Adding an Edge

Function
This API is used to add an edge.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges

Table 5-55 URI parameters


Parameter Mandato Type Description
ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 189
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-56 Request body parameters


Param Manda Type Description
eter tory

source Yes Strin Source vertex name


g

target Yes Strin Target vertex name


g

label No Strin Label of an edge. If no label exists, set it to


g __DEFAULT__.

propert No Obje Value of each property


ies ct

parallel No paral How to process repetitive edges


Edge lelEd
ge
Obje
ct

Table 5-57 parallelEdge parameters


Paramet Manda Type Description
er tory

action No String Processing mode of repetitive edges. The


value can be allow, ignore, or override. The
default value is allow.
● allow indicates that repetitive edges are
allowed.
● ignore indicates that subsequent
repetitive edges are ignored.
● override indicates that the previous
repetitive edges are overwritten.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 190
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramet Manda Type Description


er tory

ignoreLa No Boolean Whether to ignore labels on repetitive edges.


bel The value is true or false, and the default
value is true.
● true: Indicates that the repetitive edge
definition does not contain the label. That
is, the <source vertex, target vertex>
indicates an edge, excluding the label
information.
● false: indicates that the repetitive edge
definition contains the label. That is,
<Source vertex, Target vertex, Label>
indicates an edge.

targetPr No targetProp List of properties used to determine repetitive


operties erties edges. If this parameter is specified,
Array 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
● The current version supports only overwriting
by property and does not support ignoring by
property. In addition, only one property takes
effect for each label.
● Properties of the non-single type are
considered unequal.

Table 5-58 targetProperties parameter description


Paramet Manda Type Description
er tory

label Yes String Labels whose repetitive edges need to be


determined by property

propertie Yes Array List of properties whose repetitive edges


s need to be determined by property. Currently,
only one property is supported. If multiple
properties are entered, the first property is
used.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 191
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-59 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.

data Object Query results. If the query is successful, the query


result will be returned. If the query fails, this
parameter will be 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"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 192
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

]
}
]
}
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"result":"success",
"data":{"index":"0"}
}

Status code: 400

Example response (failed request)


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 Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.2.4 Deleting an Edge

Function
This API is used to delete an edge based on the specified property value or index.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 193
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/edges?
source={sourceVertex}&target={targetVertex}&index={index}&label={label}&proper
ty={name}&value={value}

Request Parameters

Table 5-60 Request body 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

source Yes String Source vertex name

target Yes String Target vertex name

index No Integer Edge index


● If property has been
set, ignore this
parameter.
● If property is not set,
the edge is deleted
based on index.
● If neither property nor
index is set, all edges
between source and
target are deleted.

label No String Indicates the label of an


edge, which can accelerate
the search of property
values. This parameter
must be used together
with property.

property No String Property name of the edge


to be deleted. This
parameter must be used
together with value.

value No String Indicates the property


value of the edge to be
deleted. This parameter
must be used together
with property.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 194
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Delete an edge. The source vertex name of the edge to be deleted is Vivian, the
target vertex name is Lethal, the edge index value is 0, the edge label value is
rate, the property name is Score, and the property value is 5.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges?
source=Vivian&target=Lethal Weapon&index=0&label=rate&property=Score&value=5

NOTE

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

Response Parameters

Table 5-61 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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 (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "edge source vertex [Lily] does not exist",
"errorCode": "GES.8000"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 195
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.2.5 Updating an Edge Property

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 5-62 URI parameters

Parameter Mandat Type Description


ory

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 196
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

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 5-63 Request body parameters


Paramet Mandatory Type Description
er

propertie Yes Object Value of each property


s

label No String Name of a label

targetPro No Array Properties used to determine duplicate


perties 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 5-64.

Table 5-64 targetProperty parameter description


Parameter Manda Type Description
tory

label Yes String Label name. The label of duplicate edges is


determined by the property.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 197
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Type Description


tory

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"
]
}
]
}

NOTE

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

Response Parameters

Table 5-65 Response body parameters

Paramete Type Description


r

errorMess String System prompt.


age ● 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 198
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Type Description


r

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 (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (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 Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.2.6 Querying Edges in Batches

Function
This API is used to query the detailed information about edges in batches based
on the source vertices, target vertices, and indexes of the edges. Information about
edges and properties is returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 199
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
query

Table 5-66 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 5-67 Request body parameter


Param Manda Type Description
eter tory

edges Yes Obje Edge array to be queried


ct

Table 5-68 edges parameter description


Param Manda Type Description
eter tory

source Yes Strin Source vertex of an edge


g

target Yes Strin Target vertex of an edge


g

index No Strin Edge index


g

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 200
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-69 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.

data String The data field is contained when the query is


successful, and the data field contains the edges
query result.

result String Query result. If the query is successful, the value


is success. If the query fails, the value is failed.

Example Request
Query details about edges in batches based on the source vertex, target vertex,
and index. The source nodes of the edges to be queried are 39631050_Landscape
and 27803870_Landmark building.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
query
{
"edges": [{
"source": "39631050_Landscape",
"target": "27803870_ Landmark building"
},{
"index": "0",
"source": "27803870_Landmark building",
"target": "27661363_ Jiuhua Hot Spring"
}]
}

NOTE

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

Example Response
Status code: 200
Example successful response
{
"data": {

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 201
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"edges": [
{
"index": "24",
"source": "39631050_Landscape",
"label": "superclassOf",
"properties": {
"popularity": [
0
]
},
"target": "27803870_ Landmark building"
},
{
"index": "0",
"source": "27803870_Landmark building",
"label": "superclassOf",
"properties": {
"popularity": [
0
]
},
"target": "27661363_ Jiuhua Hot Spring"
}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"parameter does not contain 'source'",
"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.

5.1.2.7 Adding Edges in Batches

Function
This API is used to add edges in batches.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 202
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
add

Table 5-70 URI parameters


Parameter Mandato Type Description
ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_nam Yes String Graph name


e

Request Parameters
Parameter Mand Type Description
atory

edges Yes Obje Edge array to be added


ct

parallelEdge No para How to process repetitive edges


llelE
dge
Obje
ct

createNotExi No Bool Whether to add source or target vertices that do


sts ean not exist in the edges parameter before adding
edges. The default value is false, which does not
affect the original functions and semantics.
If this parameter is set to true, source or target
vertices that do not exist in the edges parameter
are added prior to the edges.

Table 5-71 edges parameter description


Param Manda Type Description
eter tory

source Yes Strin Source vertex of an edge


g

target Yes Strin Target vertex of an edge


g

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 203
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Manda Type Description


eter tory

label Yes Strin Edge label


g

propert No Obje Value of each property


ies ct

Table 5-72 parallelEdge


Paramet Manda Type Description
er tory

action No String Processing mode of repetitive edges. The


value can be allow, ignore, or override. The
default value is allow.
● allow indicates that repetitive edges are
allowed.
● ignore indicates that subsequent
repetitive edges are ignored.
● override indicates that the previous
repetitive edges are overwritten.

ignoreLa No Boolean Whether to ignore labels on repetitive edges.


bel The value is true or false, and the default
value is true.
● true: Indicates that the repetitive edge
definition does not contain the label. That
is, the <source vertex, target vertex>
indicates an edge, excluding the label
information.
● false: indicates that the repetitive edge
definition contains the label. That is,
<Source vertex, Target vertex, Label>
indicates an edge.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 204
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramet Manda Type Description


er tory

targetPr No targetProp List of properties used to determine repetitive


operties erties edges. If this parameter is specified,
Array 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
● The current version supports only overwriting
by property and does not support ignoring by
property. In addition, only one property takes
effect for each label.
● Properties of the non-single type are
considered unequal.

Table 5-73 targetProperties


Paramet Manda Type Description
er tory

label Yes String Labels whose repetitive edges need to be


determined by property

propertie Yes Array List of properties whose repetitive edges


s need to be determined by property. Currently,
only one property is supported. If multiple
properties are entered, the first property is
used.

Response Parameters

Table 5-74 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 205
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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 Request
Add edges in batches. The source vertex is 46, the target vertices are 39 and 38,
and the edge label is rate.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-add
{
"parallelEdge": {
"action": "override",
"ignoreLabel": false,
"targetProperties": [
{
"label": "rate",
"properties": [
"Datetime"
]
},
{
"label": "superclassOf",
"properties": [
"popularity"
]
}
]
},
"createNotExists": true,
"edges": [
{
"source": "46",
"target": "39",
"label": "rate",
"properties": {
"Rating": [
5
],
"Datetime": [
"2018-01-01 20:30:05"
]
}
},
{
"source": "46",
"target": "38",
"label": "rate",
"properties": {
"Rating": [
4
],
"Datetime": [
"2018-01-01 20:30:05"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 206
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

]
}
}
]
}

NOTE

● SERVER_URL: Address for accessing a graph. For details about its value, see Using
Service Plane APIs.
● In the example, if vertices 46 and 39 are not in the original graph, create vertices 46 and
39, retain the default value of each label, and add an edge.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result":"success",
"data": {
"edges": [
{
"index": "7",
"source": "46",
"target": "39"
},
{
"index": "0",
"source": "46",
"target": "38"
}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"edge source vertex [Lily] does not exist",
"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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 207
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.1.2.8 Deleting Edges in Batches

Function
This API is used to delete edges in batches based on the source vertices, target
vertices, and indexes of the edges.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
delete

Table 5-75 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_nam Yes String Graph name


e

Example Request
Delete edges in batches. The source vertices of the edges are
39631050_Landscape and 27803870_Landmark building, and the target vertices
of the edges are 27803870_Landmark building and 27661363_Villa hot spring.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-delete
{
"edges": [
{
"source": "39631050_Landscape",
"target": "27803870_ Landmark building"
},
{
"index": "0",
"source": "27803870_Landmark building",
"target": "27661363_Villa hot spring"
}
],
"ignoreError": true
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 208
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-76 Request body parameters


Param Manda Type Description
eter tory

edges Yes Obje Edge array to be deleted


ct

executi No Strin sync indicates the synchronous mode, and async


onMod g indicates the asynchronous mode. The default value
e is sync.

ignoreE No Boole Whether to ignore errors, for example, the edge to


rror an delete does not exist. The default value is false,
indicating that errors will not be ignored. Errors in
JSON format cannot be ignored.

Table 5-77 edges parameter description


Param Manda Type Description
eter tory

source Yes Strin Source vertex of an edge


g

target Yes Strin Target vertex of an edge


g

index No Strin Edge index


g

label No Strin Label of an edge. If the index parameter is set, this


g parameter is ignored. If the index parameter is not
set, an edge that meets the source, target, and
label conditions is deleted. If the specified label
value does not exist in the schema or the edge with
the same label does not exist, no edge will be
deleted.

Response Parameters
● Synchronous call

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 209
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-78 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

Status code: 200


Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"parameter does not contain 'source'",
"errorCode":"GES.8000"
}

● Asynchronous call

Table 5-79 Response body parameters


Paramete Mandat Type Description
r ory

errorMess No String System prompt.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 210
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Mandat Type Description


r ory

errorCode No 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.

jobId No String ID of the deletion job.


This parameter is left blank if the
request fails. This ID can be used as a
request parameter to obtain the
deletion result through the API for
querying the job status.

jobType No Integer Task type. This parameter is left blank if


the request fails.

Status code: 200


Example response (successful request)
Http Status Code: 200
{
"jobId": "500dea8f-9651-41fe-8299-c20f13a032ea",
"jobType": 3
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [test_117d] is not found",
"errorCode": "GES.8402"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 211
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.1.2.9 Updating Edge Properties in Batches

Function
This API is used to update edge properties in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?
action_id={actionId}

Table 5-80 URI parameters

Parameter Mandato Type Description


ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_nam Yes String Graph name


e

actionId Yes String Operator. Possible values:


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

Request Parameters

Table 5-81 Request body parameters

Param Manda Type Description


eter tory

edges Yes Json Edge array to be updated

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 212
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Manda Type Description


eter tory

ignoreE No Boole Whether to ignore the update error of specific edges.


rror an The default value is false, indicating that an error
that causes the update failure must be detected. For
example, if the edge to be updated does not exist,
an error is reported and no edge is updated.
If the value is true, similar errors are ignored and
other edge properties without errors are updated.

Table 5-82 edges parameter description

Param Manda Type Description


eter tory

source Yes Strin Source vertex of an edge


g

target Yes Strin Target vertex of an edge


g

index No Strin Edge index. If this parameter is not set, the first edge
g between vertices is updated.

propert Yes Obje Value of each property


ies ct

Response Parameters

Table 5-83 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 213
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Update edge properties in batches. The source vertex of the edge is 46, and the
target vertices of the edge are 39 and 38.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?
action_id=batch-update
{
"edges": [
{
"source": "46",
"target": "39",
"properties": {
"Rating": [
5
],
"Datetime": [
"2018-01-0120:30:05"
]
}
},
{
"source": "46",
"target": "38",
"index": "0",
"properties": {
"Rating": [
4
],
"Datetime": [
"2018-01-0120:30:05"
]
}
}
],
"ignoreError": true
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"edge source vertex [46] does not exist",
"errorCode":"GES.8221"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 214
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.1.2.10 Exporting Filtered Edges

Function
This API is used to export the edge set that meets the filter criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=export

Request Parameters

Table 5-84 Request body parameters

Param Mandatory Type Description


eter

export Yes String Export path


Path

fileNa No String Name of the exported file


me

obsPar Yes String OBS authentication parameters.


ameter For details, see Table 5-267.
s

labels Either labels or String Filter criteria of the relationship


edgeFilters is type
mandatory.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 215
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Mandatory Type Description


eter

edgeFil Either labels or String Filter criteria, in JSONArray


ters edgeFilters is format. Vertices are filtered by
mandatory. property. For details, see Table
5-49.

Response Parameters

Table 5-85 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.

jobId String ID of the edge query job


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

jobType Integer Type of an asynchronous job

Example Request
Export edges that meet filter criteria (only the asynchronous mode is supported).
The relationship type filter criterion is rate, the property names are Score and
Datetime, and the export path is demo_movie/.
POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=export
{
"labels": [
"rate"
],
"edgeFilters": [
{
"propertyName": "Score",
"predicate": ">=",
"values": [
"2"
]
},

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 216
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"propertyName": "Datetime",
"predicate": "range",
"values": [
"1998-12-27 01:00:00",
"2000-12-31 00:12:38"
],
"type": "or"
}
],
"exportPath": "demo_movie/",
"fileName": "export_rate.csv",
"obsParameters": {
"accessKey": "XXXXXXX",
"secretKey": "XXXXXXX"
}
}

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "03e774f5-29ea-4187-9508-5435f3892ead016886200",
"jobType": 0
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "Bad Request, parameter labels and vertexFilters cannot all be null",
"errorCode": "GES.8103"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 217
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.2.11 Deleting Filtered Edges

Function
This API is used to delete the edge set that meets the filter criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=delete

Request Parameters

Table 5-86 Request body parameters


Param Mandatory Type Description
eter

labels Either labels or String Filter criteria of the relationship


edgeFilters is type
mandatory.

edgeFil Either labels or String Filter criteria, in JSONArray


ters edgeFilters is format. Vertices are filtered by
mandatory. property.
For details, see Table 5-49.

Response Parameters

Table 5-87 Response body parameters


Paramete Type Description
r

errorMess String System prompt.


age ● 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.

job_id String ID of the edge query job


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 218
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Type Description


r

jobType Integer Type of an asynchronous job

Example Request
Delete edges that meet filter criteria (only the asynchronous mode is supported).
The relationship type filter criterion is rate, and the property names are Score and
Datetime.
POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=delete
{
"labels": [
"rate"
],
"edgeFilters": [
{
"propertyName": "Score",
"predicate": ">=",
"values": [
"2"
]
},
{
"propertyName": "Datetime",
"predicate": "range",
"values": [
"1998-12-27 01:00:00",
"2000-12-31 00:12:38"
],
"type": "or"
}
]
}

POST https://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=delete
{
"labels": [
"rate"
],
"edgeFilters": [
{
"propertyName": "Score",
"predicate": ">=",
"values": [
"2"
]
},
{
"propertyName": "Datetime",
"predicate": "range",
"values": [
"1998-12-27 01:00:00",
"2000-12-31 00:12:38"
],
"type": "or"
}
]
}

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 219
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response (successful request)


Http Status Code: 200
{
"jobId": "f9987cab-64d3-4b3d-ac43-e91ae0c21bef168127124",
"jobType": 0
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "Bad Request, parameter labels and edgeFilters cannot all be null",
"errorCode": "GES.8103"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.3 Metadata Operation APIs

5.1.3.1 Adding a Label

Function
This API is used to add a label.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 220
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-88 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
● Request parameters (OBS scenario)

Table 5-89 Request body parameters


Paramet Mandat Type Description
er ory

name Yes String Name of a label


A label name can contain a maximum of
256 characters.
Only letters, digits, spaces, and special
characters %,@,#,$,:,?,*, .,+,- are allowed.

propertie Yes Object Properties you want to add to the label. For
s details about the parameters, see Table
5-90.

Table 5-90 properties parameter description


Paramet Mandat Type Description
er ory

property No Object Label properties. For details about the


parameters, see Table 5-91.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 221
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-91 property parameters


Paramete Mandatory Type Description
r

name Yes Strin Property name


g 1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain <,
>, &, ASCII 14,15 or 30.
3. The property under a label must be
unique.

type No Strin Label type, indicating that the label is


g used for vertices or edges. The value
can be vertex, edge, or all.
The default value is all, indicating that
the label applies to vertices and edges.

properties Yes Obje Properties you want to add to the


ct label. For details about the parameters,
see Table 5-90.

Table 5-92 properties elements


Paramet Mandat Type Description
er ory

property No Object Label properties. For details about the


parameters, see Table 5-93.

Table 5-93 property parameter description


Paramete Manda Type Description
r tory

name Yes String Property name


1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain <, >, &,
ASCII 14,15 or 30.
3. The property under a label must be
unique.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 222
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Manda Type Description


r tory

cardinality Yes String Cardinality type of a property. Possible


values:
● single
● list
● set

dataType Yes String Data type of a property. For details, see


the metadata types in Table 4-122.

typeName No String Total number of parameters of the enum


Count (This type. This parameter controls the
param typeName quantity.
eter is
manda
tory if
dataTy
pe is
enum.
)

typeName No String Names of parameters of the enum type.


* (This For example, if the value of
param typeNameCount is 2, the parameter
eter is contains typeName1:science and
manda typeName2:literature.
tory if
dataTy
pe is
enum.
)

● Request parameters (HDFS scenario)

Table 5-94 Request body parameters


Parameter Mandatory Type Description

name Yes String Name of a concept. The value


can contain 1 to 63 characters.
Only letters, digits, and
underscores (_) are allowed,
for example, "gene".

properties Yes List Property list of a concept. Each


For concept contains a maximum
details, of 255 properties.
see Table
5-95.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 223
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

relations No List Relation list of a concept. Each


For concept contains a maximum
details, of 255 relations.
see Table
5-96.

NOTE

Every concept must have the name property.

Table 5-95 Property parameters

Parameter Mandatory Type Description

name Yes String Property name. The value


contains 1 to 63 characters,
including uppercase letters,
lowercase letters, digits, and
underscores (_), and cannot
start with an underscore, for
example, cited_times. The
value cannot be reserved
property names id or label.

type No Enumerati Property type. The default


on value is single_string.
Available values include
single_string, set_string,
single_int, set_int,
single_double, set_double,
single_bool.

Table 5-96 Relation parameters

Parameter Mandatory Type Description

name Yes String Name of a relation between


concepts. The value can
contain 1 to 63 characters.
Only letters, digits, and
underscores (_) are allowed,
for example, cited_times.

target Yes String Target concept of the current


relation

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 224
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-97 Parameter description

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 Request
Add a label. The label name is book. The label has three properties to add.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels
{
"name": "book",
"type": "vertex",
"properties": [
{
"property": {
"name": "Title",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Version",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Category",
"typeName1": "science",
"typeName2": "literature",
"typeNameCount": "2",
"cardinality": "single",
"dataType": "enum"
}
}
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 225
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "label already exists",
"errorCode": "GES.8801"
}

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.

5.1.3.2 Updating a Label

Function
In the current version, this API only allows appending properties to existing labels,
but not deleting existing properties or updating the order of existing properties. It
can either append properties to existing labels or overwrite the entire label.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}/properties

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 226
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-98 URI parameters

Paramete Mandato Type Description


r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

label_nam Yes String Label name


e

Request Parameters

Table 5-99 Request body parameters

Paramet Mandat Type Description


er ory

propertie Yes Object Property array to be appended. For details


s about the parameters, see Table 5-100.

override No Bool The default value is false. If the value is true,


the entire label is overwritten.

Table 5-100 properties parameter description

Paramet Mandatory Type Description


er

property No Object Label properties. For details about the


parameters, see Table 5-101.

Table 5-101 property parameter description

Parameter Mandatory Type Description

name Yes String Property name


1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain <, >,
&, ASCCI 14,15 and 30.
3. The property under a label must be
unique.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 227
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

cardinality Yes String Composite type of a property. Possible


values:
● single
● list
● set

dataType Yes String Data type of a property. For details, see


the metadata types in Table 4-122.

typeName No (This String Total number of parameters of the


Count parameter is enum type. This parameter controls the
mandatory if typeName quantity.
dataType is
enum.)

typeName* No (This String Names of parameters of the enum type.


parameter is For example, if the value of
mandatory if typeNameCount is 2, the parameter
dataType is contains typeName1:science and
enum.) typeName2:literature.

Response Parameters

Table 5-102 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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 Request
Update a label. The label name is book. The label has three properties to update.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 228
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}/
properties
{
"name": "book",
"override": "true",
"properties": [
{
"property": {
"name": "Title",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Version",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Category",
"typeName1": "science",
"typeName2": "literature",
"typeNameCount": "2",
"cardinality": "single",
"dataType": "enum"
}
}
]
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "label already exists",
"errorCode": "GES.8801"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 229
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.1.3.3 Querying Graph Metadata Details

Function
This API is used to query graph metadata details.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema

Table 5-103 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

Response Parameters

Table 5-104 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 230
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

data Object Query results. This parameter is left blank when the
request fails.

Table 5-105 data parameter description


Parameter Type Description

schema List Definitions of each label and associated


property field

Example Request
Query metadata details of a graph.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"schema": [
{
"label": "rate",
"type": "all",
"properties": [
{
"name": "Rating",
"type": "int",
"cardinality": "single"
},
{
"name": "Datetime",
"type": "string",
"cardinality": "single"
}
]
},
{
"label": "user",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 231
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"type": "all",
"properties": [
{
"name": "userid",
"type": "int",
"cardinality": "single"
},
{
"name": "gender",
"probableValue": [
"F",
"M"
],
"type": "enum",
"cardinality": "single"
},
{
"name": "age",
"probableValue": [
"Under 18",
"18-24",
"25-34",
"35-44",
"45-49",
"50-55",
"56+"
],
"type": "enum",
"cardinality": "single"
},
{
"name": "occupation",
"probableValue": [
"other or not specified",
"academic/educator",
"artist",
"clerical/admin",
"college/grad student",
"customer service",
"doctor/health care",
"executive/managerial",
"farmer",
"homemaker",
"K-12 student",
"lawyer",
"programmer",
"retired",
"sales/marketing",
"scientist",
"self-employed",
"technician/engineer",
"tradesman/craftsman",
"unemployed",
"writer"
],
"type": "enum",
"cardinality": "single"
},
{
"name": "Zip-code",
"maxDataSize": 12,
"type": "char array",
"cardinality": "single"
}
]
},
{
"label": "book",
"type": "vertex",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 232
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"properties": [
{
"name": "Title",
"type": "string",
"cardinality": "single"
},
{
"name": "Version",
"type": "string",
"cardinality": "single"
},
{
"name": "Category",
"probableValue": [
"science",
"literature"
],
"type": "enum",
"cardinality": "single"
}
]
},
{
"label": "default",
"type": "all"
},
{
"label": "movie",
"type": "all",
"properties": [
{
"name": "movieid",
"type": "int",
"cardinality": "single"
},
{
"name": "title",
"type": "string",
"cardinality": "single"
},
{
"name": "genres",
"type": "string",
"cardinality": "single"
}
]
},
{
"label": "__DEFAULT__",
"type": "all"
}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8003"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 233
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.3.4 Deleting a Label

Function
This API is used to delete a label as well as the vertices and edges associated with
the label.

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}

Table 5-106 URI parameters


Paramete Mandato Type Description
r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

label_nam Yes String Name of a label


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 234
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-107 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.

data Object Query results. This parameter is left blank when


the request fails.

Table 5-108 data parameter description


Parameter Type Description

outputs Integer Number of deleted vertices or edges when a label


is deleted.

Example Request
Delete a label as well as the vertices and edges associated with the label.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/{label_name}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "72506da3-d2e2-4709-8ca3-a5376a42db23001234245",
"jobType": 3
}

Status code: 400


Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 235
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8003"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.3.5 Adding Labels in Batches

Function
This API is used to add labels in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/action?action_id=batch-add

Table 5-109 URI parameters


Paramete Mandato Type Description
r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 236
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-110 Request body parameters


Parame Manda Type Description
ter tory

labels Yes String Metadata labels

Table 5-111 label parameters


Parame Manda Type Description
ter tory

name Yes String Name of a label. The value can contain a


maximum of 256 characters, including numbers,
spaces, and the following special characters: %
@ # $:? *. + - _.

properti Yes Object Property array to be added. The array element


es is property. For details about the parameters,
see Table 5-112.

Table 5-112 property parameter description


Parameter Mandator Type Description
y

name Yes String Property name


1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain <,
>, &, ASCII 14, 15 or 30.
3. The property under a label must be
unique.

cardinality Yes String Cardinality type of a property. Possible


values:
● single
● list
● set

dataType Yes String Data type of a property. For details, see


the metadata types in Table 8-103.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 237
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandator Type Description


y

typeNameCo No (This String Total number of parameters of the


unt parameter enum type. This parameter controls the
is typeName quantity.
mandatory
if
dataType
is enum.)

typeName* No (This String Names of parameters of the enum


parameter type. For example, if the value of
is typeNameCount is 2, the parameter
mandatory contains typeName1:science and
if typeName2:literature.
dataType
is enum.)

Response Parameters

Table 5-113 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.

data Object If some labels fail to be added, this field contains


the names of the failed labels and the failure
causes.

Example Request
Add metadata labels and their properties in batches. The names of the metadata
labels are book and movie.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 238
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels/action?
action_id=batch-add
{
"labels": [
{
"name": "book",
"type": "vertex",
"properties": [
{
"property": {
"name": "title",
"cardinality": "single",
"dataType": "string"
}
}
]
},
{
"name": "movie",
"type": "vertex",
"properties": [
{
"property": {
"name": "movieid",
"cardinality": "single",
"dataType": "int"
}
}
]
}
]
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Example response for a partially successful request


Http Status Code: 200
{
"result": "partial success",
"data": {
"failed": [
{
"cause": "label name is invalid which can only contain letters, digits, space,%,@,#,$,:,?,*,.,+,- and
_",
"labelName": "book<"
}
]
}
}

Status code: 400

Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 239
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "label already exists",
"errorCode": "GES.8801"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.3.6 Querying Schema Structure

Function
This API is used to query the structure of the generated schema (obtained from
OBS).

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure?detail={details}

Table 5-114 URI parameters


Paramete Mandato Type Description
r ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_na Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 240
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Mandato Type Description


r ry

details No String Detailed information of the schema


structure. The value can be SIMPLE or FULL.
If you set this parameter to SIMPLE, only
the labels of vertices or edges are returned.
If you set it to FULL, the number of vertices
or edges is returned in addition to the
labels. If this parameter is left empty, the
default value SIMPLE is used.

Response Parameters

Table 5-115 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.

schema Object Schema structure. For details about the


parameters, see Table 5-116.

Table 5-116 schema parameter description


Parameter Type Description

vertices String Vertex result set. If the graph is empty,


the return value is empty. For details
about the parameters, see Table 5-117.

edges String Edge result set. If the graph is empty,


the return value is empty. For details
about the parameters, see Table 5-118.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 241
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-117 vertices parameter description


Parameter Type Description

vertex String Label name

weight String Number of vertices that have the label

Table 5-118 edges parameter description


Parameter Type Description

source String Label the start vertex.

target String Label the end vertex.

relation String Relationship label

weight String Number of edges that have the label

Example Request
Query a generated schema (obtained from OBS).
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure?detail=SIMPLE

Example Response
Status code: 200
Example response (successful request)
{
"schema": {
"vertices": [
{
"vertex": "user",
"weight": 100
},
{
"vertex": "movie",
"weight": 46
}
],
"edges": [
{
"weight": 1209,
"source": "user",
"target": "movie",
"relation": "rate"
},
{
"weight": 450,
"source": "user",
"target": "user",
"relation": "default"
}
]
}
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 242
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "Bad Request, parameter [detail] cannot be null.",
"errorCode": "GES.8813"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found No resources found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.3.7 Generating a Schema Structure

Function
This API is used to generate a schema structure where labels are represented with
vertices and the relationship between the labels are represented with edges, and
store the schema structure in an OBS bucket.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure/build

Table 5-119 URI parameters

Paramete Mandato Type Description


r ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_na Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 243
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-120 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.

jobId String ID of the vertex query job. This


parameter is left blank when the
request fails.

jobType Integer Type of an asynchronous job

Example Request
Generate a schema where labels are represented with vertices and the relationship
between the labels are represented with edges.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure/build

Example Response
Status code: 200
Example response (successful request)
{
"jobId": "2e0c08e1-3fbb-4b33-8776-4809176068d7154236181",
"jobType": 1
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "Bad Request ",
"errorCode": "GES.8813"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 244
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.1.4 Index Operation APIs

5.1.4.1 Creating an Index

Function
This API is used to create indexes based on the specified information such as
indexName and IndexType. Currently, composite indexes and full-text indexes are
supported.
● Composite indexes include global vertex indexes
(GlobalCompositeVertexIndex) and global edge indexes
(GlobalCompositeEdgeIndex). Composite indexes can be used to create
indexes on labels and properties. Indexes can accelerate the query speed.
● Full-text indexes (FullTextIndex) can implement functions such as full-text
search and fuzzy search. If you search data immediately after an update, you
may get the old data. You are advised to query the data 1 second after the
update. For details about how to use full-text indexes, see Querying Vertices
Based on Filter Criteria and Querying Edges Based on Filter Criteria. You
can also use full-text indexes in Cypher statements. For details, see Cypher
Operation APIs.
NOTE

● Currently, the full-text indexing feature is supported only in the ECS/BMS+MRS


deployment mode.
● After an index is created, wait for 30 seconds for index synchronization. After the
synchronization is complete, Cypher queries can be accelerated using the index.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 245
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Index Feature
Feature Fuzzy Search Speed Flexibility

Composite No Fast Fixed composite property keys


indexes only

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/indices

Table 5-121 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

Example Request
Create a composite index. The index name is ageIndex and the index type is
global vertex index.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
"indexName":"ageIndex",
"indexType": "GlobalCompositeVertexIndex",

"hasLabel": "true",
"indexProperty": ["age"]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 246
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-122 Request body parameters


Paramete Mandatory Type Description
r

indexNam Yes String Index name. Only letters, digits, hyphens


e (-), and underscores (_) are allowed.
Other characters are not allowed. The
index name can contain a maximum of
63 characters.

indexType Yes String Index type. The value is case-sensitive.


GlobalCompositeVertexIndex is a global
composite vertex index.

hasLabel No Boolean Whether labels exist. The default value is


false.
● true
● false

indexProp No (If String Index property list.


erty hasLabel is The property types that can be used to
false or create indexes include integer, float,
null, this double, long, enum, char array, string,
parameter is and date.
mandatory.)

NOTE

If a property is of the string or char array type, the value must be no more than 40 bytes.
The excess part will be deleted.

Response Parameters

Table 5-123 Response body parameters


Parameter Type Description

errorMessa String System prompt.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 247
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

jobId String ID of an asynchronous job


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

jobType Integer Type of an asynchronous job

result String If the execution is successful, the value of


result is success.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232",
"jobType": 8
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8603"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 248
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.1.4.2 Deleting an Index

Function
This API is used to delete an index based on the specified indexName.

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/indices/{index_name}

Table 5-124 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

index_name Yes String Index name

Response Parameters

Table 5-125 Parameter description

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

jobId String ID of an asynchronous job


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 249
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

jobType Integer Type of an asynchronous job

Example Request
Delete an index by name. The index name is ageIndex.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices/ageIndex

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "fb74314e-a82d-41b2-8900-96e2559fa0d9000168232",
"jobType": 9
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8604 "
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 250
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.4.3 Querying Indexes

Function
This API is used to query all indexes created on a graph.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/indices

Table 5-126 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

Response Parameters

Table 5-127 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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.

data Object Index data you want to query

result String Query results. If the query is successful, success


is displayed.

indices List Indexes of the query results

indexType String Index types of the query results

indexName String Index names of the query results

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 251
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

indexProper List Index properties of the query results


ty

hasLabel String Whether the indexes of the query results contain


labels
NOTE
For full-text indexes, the default value is false.

Example Request
Query all indexes created on a graph.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"result": "success",
"indices": [
{
"indexType": "GlobalCompositeVertexIndex",
"indexName": "ageIndx",
"indexProperty": [
"age"
],
"hasLabel": "true"

}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8605"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 252
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.1.5 Gremlin Operation APIs

5.1.5.1 Executing a Gremlin Query

Function
This API is used to return the query result of a Gremlin statement.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
gremlin-query

Table 5-128 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 253
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-129 Request body parameter


Parameter Mandatory Type Description

command Yes String Query command (Gremlin


language)

Response Parameters

Table 5-130 Response body parameters


Parameter Type Description

errorMessa String System prompt.


ge ● 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.

data Object Query results. This parameter is left blank when


the request fails.

Example Request
Perform the Gremlin query operation. If the query command is g.V().limit(100),
all vertices are queried, but the number of returned vertices is limited to 100.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-gremlin-
query
{
"command":"g.V().limit(100)"
}

NOTE

● SERVER_URL: Address for accessing a graph. For details about its value, see Using
Service Plane APIs.
● The size of the request body cannot exceed 64 MB.

Example Response
Status code: 200
Example response (successful request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 254
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 200

{
"data": {
"runtime": 0.775425022,
"vertices": [
{
"id": "Vivian",
"label": "user",
"properties": {
"Occupation": [
"artist"
],
"Name": [
"Vivian"
],
"Zip-code": [
"98133"
],
"Gender": [
"F"
],
"Age": [
"25-34"
]
}
},
......
]
}
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "org.apache.tinkerpop.gremlin.driver.exception.ResponseException: No such property: g1
for class: Script4",
"errorCode": "GES.8503"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 255
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6 Algorithm APIs

5.1.6.1 Executing an Algorithm

Function
This API is used to run specified algorithms based on entered parameters.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
algorithm

Table 5-131 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

Example Request
Execute a specified algorithm. The algorithm name is pagerank, the weight
coefficient is 0.85, the convergence precision is 0.00001, the maximum number of
iterations is 1000, and traversal is performed along edge directions.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-algorithm
{
"algorithmName":"pagerank",
"parameters":{
"alpha":0.85,
"convergence":0.00001,
"max_iterations":1000,
"directed":true
}
}

NOTE

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

Request Parameters
For details about the parameters, see Common algorithm parameters.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 256
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-132 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.

jobId String ID of the algorithm execution job. This


parameter is left blank when the request fails.
NOTE
You can view 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 when the
request fails.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 4200


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

Status Codes
Return Value Description

400 Bad Request Request error.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 257
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.1.6.2 Algorithm API Parameter References

5.1.6.2.1 Common Algorithm Parameters

Request Example
{
"algorithmName":"XXX",
"parameters":{
...
}
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 258
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-133 Request body parameters


Parameter Mandat Type Description
ory

algorithmN Yes String Algorithm name.


ame Available values are as follows (algorithm
names you can call):
● pagerank
● personalrank
● kcore
● k_hop
● shortest_path
● all_shortest_paths
● filtered_shortest_path
● sssp
● shortest_path_of_vertex_sets
● n_paths
● closeness
● label_propagation
● louvain
● link_prediction
● node2vec
● realtime_recommendation
● common_neighbors
● connected_component
● degree_correlation
● triangle_count
● cluster_coefficient
● common_neighbors_of_vertex_sets
● all_shortest_paths_of_vertex_sets
● filtered_circle_detection
● filtered_all_pairs_shortest_paths
● filtered_all_shortest_paths
● filtered_n_paths

parameters Yes Object Algorithm parameters. For details, see the


parameter description of each algorithm.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 259
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-134 New Body parameters of version 2.1.7


Parameter Mandat Type Description
ory

executionM No String ● sync: synchronous


ode ● async: asynchronous
The default value is async.
Supported algorithms are as follows
(algorithm names you can call):
● k_hop
● shortest_path
● all_shortest_paths
● filtered_shortest_path
● shortest_path_of_vertex_sets
● n_paths
● realtime_recommendation

offset No Integer Synchronization result offset. The default


value is 0.
NOTE
This parameter is available when
executionMode is sync.
Supported algorithms are as follows
(algorithm names you can call):
● k_hop
● shortest_path
● all_shortest_paths
● shortest_path_of_vertex_sets
● n_paths
● realtime_recommendation
● filtered_all_pairs_shortest_paths
● filtered_all_shortest_paths

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 260
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

limit No Integer Maximum number of returned


synchronization results. The maximum
value is 100000. The default value is
100000.
NOTE
This parameter is available when
executionMode is sync.
Supported algorithms are as follows
(algorithm names you can call):
● k_hop
● shortest_path
● all_shortest_paths
● shortest_path_of_vertex_sets
● n_paths
● realtime_recommendation
● filtered_all_pairs_shortest_paths
● filtered_all_shortest_paths

Table 5-135 New Body parameters of version 2.2.4


Parameter Mandat Type Description
ory

vertex_filter No Object Filter criteria for the vertices on a path.


Supported algorithms are as follows
(algorithm names you can call):
● filtered_shortest_path
● filtered_all_pairs_shortest_paths
● filtered_all_shortest_paths
For details about the format, see Table
5-299 in "Filtered-query API".

edge_filter No Object Filter criteria for the edges (relationships)


on a path.
Supported algorithms are as follows
(algorithm names you can call):
● filtered_shortest_path
● filtered_all_pairs_shortest_paths
● filtered_all_shortest_paths
For details about the format, see Table
5-299 in "Filtered-query API".

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 261
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

filters No Object Filter criteria. Each element in the array


corresponds to a filter. This parameter
applies only to filtered circle detection. For
details about the format, see filters
element formats.
Supported algorithms:
● filtered_n_paths

Example Response
Algorithms are executed based on input parameters. You can call Querying Job
Status and Execution Results to use the job_id returned by the algorithm to
obtain the algorithm execution result.
Status code: 200
Example response (successful request)
{
"data": {

"outputs": {
$response_data //Result of each algorithm. The results vary with the algorithm.
"runtime": 1.365867,
"data_return_size": 3,
"data_offset": 0,
"data_total_size": 100
}
},
"status": "complete"
}

NOTE

response_data indicates the result of each algorithm. The results vary with algorithms.

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
"errorCode":"GES.8301"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 262
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-136 Response body parameters


Parameter Type Description

errorMessa String System prompt. If execution succeeds, this parameter


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

errorCode String System prompt. If execution succeeds, this parameter


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

status String Returned job status for a successful query. Possible


values are waiting, running, and complete. This
parameter is left blank when the query fails.

data Object Algorithm execution result. This parameter is left blank


when the query fails.

5.1.6.2.2 PageRank

Table 5-137 parameters parameter description


Parameter Mandatory Type Description

alpha No Double Weight coefficient (also called


damping coefficient). The value
range is (0,1), and the default
value is 0.85.

convergence No Double Convergence The value range is


(0,1), and the default value is
0.00001.

max_iterations No Integer Maximum iterations An integer


ranging from 1 to 2147483647.
For frontend calls, the range is
[1,2000]. The default value is
1000.

num_thread No Integer Number of concurrent threads.


The value ranges from 1 to 40. If
the value is less than 1, it is
automatically set to 1. If the
value is greater than 40, it is
automatically set to 40. The
default value is 4.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 263
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

directed No Boolean Whether to consider the edge


direction. The value can be true
or false. The default value is
true.

NOTE

Iterations and convergence


The algorithm is terminated when either the maximum number of iterations is reached or
the convergence precision is met.
1. Generally, a smaller convergence precision and larger number of iterations lead to a
better effect of the algorithm.
2. To meet a certain convergence precision, you should set the number of iterations as
large as possible.
3. A larger number of iterations means a longer algorithm running time. To ensure that
the algorithm runs at a certain number of iterations (that is, in a fixed duration), you
should set the convergence precision as small as possible.

Table 5-138 response_data parameter description

Parameter Type Description

pagerank List PageRank value of each vertex.


The format is as follows:
[{vertexId:rankValue},...],
where
vertexId is of the string type.
rankValue is of the double type.

5.1.6.2.3 PersonalRank

Table 5-139 parameters parameter description

Parameter Mandatory Type Description

source Yes String Node ID

alpha No Double Weight coefficient (also called


damping coefficient). The value
range is (0,1), and the default
value is 0.85.

convergence No Double Convergence


The value range is between 0
and 1. The default value is
0.00001.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 264
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

max_iterations No Integer Maximum iterations. An integer


ranging from 1 to 2147483647.
For frontend calls, the range is
[1,2000]. The default value is
1000.

num_thread No Integer Number of concurrent threads.


The value ranges from 1 to 40. If
the value is less than 1, it is
automatically set to 1. If the
value is greater than 40, it is
automatically set to 40. The
default value is 4.

directed No Boolean Whether to consider the edge


direction. The value can be true
or false. The default value is
true.

NOTE

For details about algorithm iterations and convergence, see Iterations and Convergence of
PageRank.

Table 5-140 response_data parameter description


Parameter Type Description

source String -

personalrank List PersonalRank value of each vertex.


The format is as follows:
[{vertexId:rankValue},...],
where
vertexId is of the string type.
rankValue is of the double type.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 265
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.4 K-core

Table 5-141 parameters parameter description


Parame Manda Description Ty Value Range Default
ter tory pe Value

k Yes Number of cores Int Greater than or -


The algorithm eg equal to 0
returns vertices er
whose number of
cores is greater
than or equal to
k.

Table 5-142 response_data parameter description


Parameter Type Description

coreness List<Map< Coreness value (coreness ≥ k) of each


String,Inte vertex. The format is as follows:
ger>> [{vertexId:corenessValue},...],
where
vertexId is of the string type.
corenessValue is of the integer type.

5.1.6.2.5 K-Hop

Table 5-143 parameters parameter description


Parameter Mandatory Type Description

k Yes Integer Number of hops. The value


ranges from 1 to 100.

num_thread No Integer Number of concurrent


threads. The value ranges
from 1 to 40. If the value is
less than 1, it is automatically
set to 1. If the value is
greater than 40, it is
automatically set to 40. The
default value is 4.

source Yes String Vertex ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 266
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

mode No String Direction. The options are:


● OUT: Hop from the
outgoing edges
● IN: Hop from the incoming
edges
● ALL: Hop from edges in
both directions
The default value is OUT.

statistics No Boolean Whether to only return the


neighbor count statistics
results, with a value of true
or false. The default value is
false.

Table 5-144 response_data parameter description


Parameter Type Description

vertices List ID of the vertex within k hops. The format is


as follows:
[vertexId,...],
where vertexId is of the string type.

source String Source vertex ID

k Integer Number of hops

k_hop_neighbor Integer Number of vertices within k hops (excluding


s the source vertex)

5.1.6.2.6 Common Neighbors

Table 5-145 parameters parameter description


Parame Manda Description Type Value Range Default
ter tory Value

source Yes Source vertex String - -


ID

target Yes Target vertex String - -


ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 267
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-146 response_data parameter description


Parameter Type Description

vertices List Common neighbor vertices. The format is as


follows:
[vertexId,...],
where
vertexId is of the string type

common_nei Integer Number of common neighbor vertices


ghbors

source String Source vertex ID

target String Target vertex ID

5.1.6.2.7 Common Neighbors of Vertex Sets

Table 5-147 parameters parameter description


Parameter Mand Descripti Type Value Range Default
atory on Value

sources Yes Source String The value is in the -


(2.2.6) vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Alice, Nana.
The maximum ID
number is 100000.

targets Yes Target String The value is in the -


(2.2.6) vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Mike,Amy.
The maximum ID
number is 100000.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 268
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mand Descripti Type Value Range Default


atory on Value

restricted No Whether Boolea true or false true


(2.2.13) other n ● false: There is no
constraint additional constraint.
s are The found common
included neighbors are the
intersection of the
neighborhoods
corresponding to the
source vertex set
and target vertex
set.
● true: There are
additional
constraints. The
found common
neighbors are not
only the intersection
of the
neighborhoods
corresponding to the
source vertex set
and target vertex
set, but each vertex
in the common
neighbor set has at
least two
neighboring vertices
in the source vertex
set and target vertex
set.

Table 5-148 response_data parameter description


Parameter Type Description

vertices List Common neighbor vertices. The format


is as follows:
[vertexId,...],
where
vertexId is of the string type.

common_neigh Integer Number of common neighbors


bors

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 269
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.8 Link Prediction

Table 5-149 parameters parameter description


Paramet Mandat Description Type Value Range Default
er ory Value

source Yes Source vertex String - -


ID

target Yes Target vertex String - -


ID

Table 5-150 response_data parameter description


Parameter Type Description

source String Source vertex ID

target String Target vertex ID

link_prediction Double Link prediction result

5.1.6.2.9 Shortest Path

Table 5-151 parameters parameter description


Paramet Manda Description Type Value Range Defaul
er tory t Value

source Yes Source String - -


vertex ID of
a path

target Yes Target String - -


vertex ID of
a path

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 270
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramet Manda Description Type Value Range Defaul


er tory t Value

weight No Weight of String Empty or character string -


an edge ● Empty: The default
weight and distance of
edges are 1.
● Character string: The
property of the
corresponding edge is
the weight. If the edge
does not have a
property, the weight is
1 by default.
NOTE
The weight of an edge
must be greater than 0.

directed No Whether to Boole The value can be true or false


consider the an false.
edge
direction

timeWin No Time Object For details, see Table -


dow window 5-152.
used for NOTE
time timeWindow does not
filtering support the shortest path
with weight. That is,
parameters timeWindow
and weight cannot be both
specified.

Table 5-152 timeWindow parameter description

Parame Man Description Typ Value Range Def


ter dator e ault
y Valu
e

filterNa Yes Name of the time Stri Character string: The -


me property used for ng property on the
time filtering corresponding vertex/
edge is used as the time.

filterTy No Filtering by vertex or Stri V: filtering by vertex BOT


pe edge ng E: filtering by edge H
BOTH: filtering by vertex
and edge

startTi No Start time Stri Date character string or -


me ng timestamp

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 271
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parame Man Description Typ Value Range Def


ter dator e ault
y Valu
e

endTim No End time Stri Date character string or -


e ng timestamp

Table 5-153 response_data parameter description


Parameter Type Description

path List Shortest path. The format is as follows:


[vertexId,...]
where
vertexId is of the string type.

source String Source vertex ID

target String Target vertex ID

5.1.6.2.10 All Shortest Paths

Table 5-154 parameters parameter description


Paramete Mandator Description Type Value Range Default
r y Value

source Yes Source vertex String - -


ID of a path

target Yes Target vertex String - -


ID of a path

directed No Whether to Boolea true or false false


consider the n
edge direction

Table 5-155 response_data parameter description


Paramete Type Description
r

paths List All shortest paths between the source vertex and
target vertex. The format is as follows:
[[path1],[path2]]

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 272
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Type Description


r

paths_nu Integer Number of paths


mber

source String Source vertex ID

target String Target vertex ID

5.1.6.2.11 Filtered Shortest Path

Request
● Parameter description

Table 5-156 parameters parameter description


Parameter Mandatory Type Description

source Yes String Source vertex ID of a path

target Yes String Target vertex ID of a path

directed No Boolean Whether to consider the edge direction.


The default value is false.

num_threa No Integer Number of concurrent threads. The


d value ranges from 1 to 40. If the value
is less than 1, it is automatically set to
1. If the value is greater than 40, it is
automatically set to 40. The default
value is 4.

● Request example
– Synchronization
{
"executionMode": "sync",
"algorithmName": "filtered_shortest_path",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "IN",
"rightvalue": {
"value": [
"xxx",
"rate"
]
}
}
},
"vertex_filter": {
"property_filter": {

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 273
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"leftvalue": {
"property_name": "title"
},
"predicate": "PREFIX",
"rightvalue": {
"value": "tr_"
}
}
},
"parameters": {
"source": "tr_1",
"target": "tr_117",
"directed": true
}
}

– Asynchronization
{
"executionMode": "async",
"algorithmName": "filtered_shortest_path",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "IN",
"rightvalue": {
"value": [
"xxx",
"rate"
]
}
}
},
"vertex_filter": {
"property_filter": {
"leftvalue": {
"property_name": "title"
},
"predicate": "PREFIX",
"rightvalue": {
"value": "tr_"
}
}
},
"parameters": {
"source": "tr_1",
"target": "tr_117",
"directed": true
}
}

Response
● Synchronous data parameter description

Table 5-157 response_data parameter description

Param Mand Type Description


eter atory

path Yes List Vertex result set. If the last layer of filters is
vertex filtering, the data contains vertices.

source Yes String Source vertex ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 274
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Mand Type Description


eter atory

target Yes String Target vertex ID

runtim Yes Double Algorithm running time


e

● Response example
– Synchronous response example (successful request)
{
"data": {
"outputs": {
"path": [
"tr_1",
"tr_5",
"tr_26",
"tr_117"
],
"runtime": 0.735766,
"source": "tr_1",
"target": "tr_117"
}
}
}

– Synchronous response example (failed request)


{
"errorMessage": "graph [tesdt_117] is not found",
"errorCode": "GES.8402"
}

● Asynchronous response parameters

Table 5-158 response_data parameter description

Parame Manda Type Description


ter tory

errorMe No String System prompt. If execution succeeds, this


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

errorCo No String System prompt. If execution succeeds, this


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

jobId No String ID of the algorithm execution job. This


parameter is left blank when the request
fails.

jobType No Integer Job type. This parameter is left blank when


the request fails.

● Example response

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 275
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

– Asynchronous response example (successful request)


{
"jobId": "500dea8f-9651-41fe-8299-c20f13a032ea",
"jobType": 2
}

– Asynchronous response example (failed request)


{
"errorMessage": "graph [test_117d] is not found",
"errorCode": "GES.8402"
}

5.1.6.2.12 SSSP

Table 5-159 parameters parameter description


Paramet Mandat Description Type Value Range Default
er ory Value

source Yes Vertex ID Strin - -


g

directed No Whether to Bool true or false true


consider the edge ean
direction

Table 5-160 response_data parameter description


Parameter Type Description

distance List Path length of each vertex in the graph


from the source vertex. The format is as
follows:
[{vertexId:distanceValue},...],
where
vertexId is of the string type.
distanceValue is of the double type.

source String Source vertex ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 276
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.13 Shortest Path of Vertex Set

Table 5-161 parameters parameter description

Par Ma Descript Typ Value Range Defa


am nda ion e ult
ete tor Value
r y

sou Yes Source Stri The value is in the standard CSV format. -
rces vertex ng IDs are separated by commas (,), for
ID set example, Alice, Nana.
The maximum ID number is 100000.

targ Yes Target Stri The value is in the standard CSV format. -
ets vertex ng IDs are separated by commas (,), for
ID set example, Alice, Nana.
The maximum ID number is 100000.

dire No Whether Bool true or false false


cte to ean
d consider
the
edge
direction

tim No Time Obj For details, see Table 5-162. -


eWi window ect
ndo used for
w time
filtering

Table 5-162 timeWindow parameter description

Parame Man Description Typ Value Range Def


ter dator e ault
y Valu
e

filterNa No Name of the time Stri Character string: The -


me property used for ng property on the
time filtering corresponding vertex/
edge is used as the time.

filterTy No Filtering by vertex or Stri V: filtering by vertex BOT


pe edge ng E: filtering by edge H
BOTH: filtering by vertex
and edge

startTi No Start time Stri Date character string or -


me ng timestamp

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 277
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parame Man Description Typ Value Range Def


ter dator e ault
y Valu
e

endTim No End time Stri Date character string or -


e ng timestamp

Table 5-163 response_data parameter description


Parameter Type Description

path List Shortest path. The format is as follows:


[vertexId,...]
where
vertexId is of the string type.

source String Source vertex ID

target String Target vertex ID

5.1.6.2.14 n-Paths

Table 5-164 parameters parameter description


Paramet Mandat Description Type Value Range Default
er ory Value

source Yes Source vertex String - -


ID of a path

target Yes Target vertex String - -


ID of a path

directed No Whether to Boolean true or false false


consider the
edge direction

n No Number of Integer 1 to 100 10


paths

k No Number of Integer 1 to 10 5
hops

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 278
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-165 response_data parameter description


Parameter Type Description

paths List Paths between the source vertex and


target vertex. The format is as follows:
[[path1],[path2]]

paths_number Integer Number of paths

source String Source vertex ID

target String Target vertex ID

5.1.6.2.15 Filtered n-Paths

Introduction
The filtered n-Paths algorithm is used to find no more than n k-hop loop-free
paths between the source and target vertices. The start vertex (source), end vertex
(target), number of hops (k), number of paths (n), and filter criteria (filters) are
the parameters for the algorithm.
● Algorithm name: filtered_n_paths
● filtered_n_paths

Applicable Scope
Any network

Request Parameters

Table 5-166 Body format


Field Mand Type Description
atory

algorithmNa Yes String The value is filtered_n_paths.


me

parameters Yes JSON For details about the format, see Table
format 5-167.

filters Yes JSon Array Filter criteria. Each element in the array
corresponds to a filter. For details about
the format, see Table 5-168.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 279
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-167 parameters parameter description


Parameter Mandato Descripti Type Value Default Value
ry on Range

source Yes Source String Internal None


vertex vertices

target Yes Target String Internal None


vertex vertices

k Yes Number Int [2,6] 2


of hops

n Yes Number Int [1,1000] 1


of paths

Table 5-168 filters element format


Parameter Mandato Type Value Default Description
ry Range Value

edge_filter No json N/A N/A Filter criteria for


full-graph edge
query

vertex_filte No json None None Filter criteria for


r full-graph vertex
query

Table 5-169 response_data parameter description


Field Mandat Type Description
ory

path_length Yes int Path length

paths_number Yes int Number of paths

paths Yes JsonArray Path set. Example value:


["111","119","58","96","82","57","56"]
.

source Yes String Source vertex

target Yes String Target vertex

Example Request
POST http://IP:PORT/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-algorithm
{
"algorithmName": "filtered_n_paths",
"filters": [

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 280
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"edge_filter":
{
"property_filter":
{
"leftvalue":
{
"label_name": "labelName"
},
"predicate": "=",
"rightvalue":
{
"value": "default"
}
}
}
}],
"parameters":
{
"k": 6,
"n": 100,
"source": "111",
"target": "56"
}
}

Response
{
"jobId": "b14f6380-f115-46ab-990e-9a76a984ebd2154236181",
"jobType": 2
}

Example for Querying a Job


GET http://IP:PORT/ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{jobId}/status

Query Result
{
"data": {
"outputs": {
"data_return_size": 3,
"paths": [
[
"111",
"119",
"58",
"96",
"82",
"57",
"56"
],
[
"111",
"119",
"58",
"61",
"76",
"57",
"56"
],
[
"111",
"119",
"58",
"79",
"76",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 281
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"57",
"56"
]
],
"runtime": 0.000308,
"source": "111",
"path_length": 6,
"data_offset": 0,
"paths_number": 3,
"data_total_size": 3,
"target": "56"
}
},
"status": "success"
}

5.1.6.2.16 Filtered All Pairs Shortest Paths

Table 5-170 parameters parameter description


Param Man Description Type Value Range Default
eter dato Value
ry

sources Yes Set of start String The number of source -


vertex IDs. The vertices cannot
value is in the exceed 10,000.
standard CSV
input format,
that is,
multiple vertex
IDs are
separated by
commas (,).

targets Yes Set of end String The number of target -


vertex IDs. The vertices cannot
value is in the exceed 10,000.
standard CSV
input format,
that is,
multiple vertex
IDs are
separated by
commas (,).

directe No Whether the Boole The value can be true false


d edges are an or false.
directed

cutoff No Maximum Integ 1-100 6


length er

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 282
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Man Description Type Value Range Default


eter dato Value
ry

path_li No Maximum Integ ● For synchronous 100000/10


mit number of er tasks: 00000
paths The value ranges
from 1 to 100000. The
default value is
100000.
● For asynchronous
tasks:
The value ranges
from 1 to 1000000.
The default value is
1000000.

NOTE

● Synchronous tasks: Number of source vertices x Number of target vertices x Maximum


path length (cutoff) <= 1000000, Maximum number of paths (path_num) x Maximum
path length (cutoff) <= 1000000.
● This algorithm checks memory capacity. When the memory is insufficient, the error
"memory is not enough" is reported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 283
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-171 response_data parameter description


Parameter Type Description

batch_paths List Batch paths. Format:


[paths_element,...]
where
Paths_element indicates the path from a source
to a target. The format is as follows:
{
"paths": [
[
"Alice",
"Janet",
"Sue",
"Serena",
"Bonnie"
]
],
"source": "Alice",
"target": "Bonnie"
},

paths_number Integer Number of paths

5.1.6.2.17 All Shortest Paths of Vertex Sets

Table 5-172 parameters parameter description


Parameter Mand Descripti Type Value Range Default
atory on Value

sources Yes Source String The value is in the -


vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Alice, Nana.
The maximum ID
number is 100000.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 284
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mand Descripti Type Value Range Default


atory on Value

targets Yes Target String The value is in the -


vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Alice, Nana.
The maximum ID
number is 100000.

directed No Whether Boole true or false. It is a false


to an Boolean value.
consider
the edge
direction

Table 5-173 response_data parameter description

Parameter Type Description

paths List All shortest paths between the source vertex and target
vertex. The format is as follows:
[[path1],[path2]]

source String Source ID of a path

target String Target ID of a path

5.1.6.2.18 Filtered All Shortest Paths

Parameters

Table 5-174 parameters parameter description

Param Man Description Type Value Range Default Value


eter dato
ry

source Yes Source vertex ID String - -


-

target Yes Target vertex ID String - -

directe No Whether the edges Boole The value can false


d are directed an be true or
false.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 285
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-175 response_data parameter description

Parameter Type Description

paths List Paths between the source and target vertices. The
format is as follows:
[[path1],[path2]]
where
For the format of each path, see Shortest Path.

paths_number Integer Number of paths

source String Source vertex ID

target String Target vertex ID

Example Request
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-algorithm
{
"algorithmName": "filtered_all_shortest_paths",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "friends"
}
}
},
"parameters": {
"source": "Alice",
"target": "Jay",
"directed": true
}
}

Response
{
"data": {
"outputs": {
"data_return_size": 8,
"paths": [
[
"Alice",
"Janet",
"Yvette",
"Willy",
"Jay"
],
...
[
"Alice",
"Jacob",
"Jimmy",
"Cary",
"Jay"
]
],

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 286
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"runtime": 0.005276,
"source": "Alice",
"data_offset": 0,
"paths_number": 8,
"data_total_size": 8,
"target": "Jay"
}
}
}

Table 5-176 response_data parameter description


Parameter Type Description

paths List Paths between the source and target vertices. The
format is as follows:
[[path1],[path2]]
where
For the format of each path, see Shortest Path.

paths_numb Integer Number of paths


er

source String Source vertex ID

target String Target vertex ID

5.1.6.2.19 Connected Component


NOTE

This algorithm can run without specifying its parameters.

Table 5-177 response_data parameter description


Parameter Type Description

Max_WCC_size Integer Maximum number of vertices in the


largest connected component

Max_WCC_id String ID of the largest connected component

community List Connected component set


(community) corresponding to each
vertex, in [{vertexId:communityId},...]
format.
where
vertexId is of the string type.
communityId is of the string type.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 287
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.20 Label Propagation

Table 5-178 parameters parameter description


Paramete Man Descriptio Type Value Range Defaul
r dato n t
ry Value

convergen No Convergen Doubl A real number between 0 0.0000


ce ce e and 1 1

max_itera No Maximum Integ An integer ranging from 1 to 1000


tions iterations er 2147483647. For frontend
calls, the range is [1,2000].

initial No Name of String Empty or character string -


the ● Empty: Each vertex is
property allocated with a unique
used as initialization label. This
the method is applicable to
initializatio scenarios where no vertex
n label on label information exists.
a vertex
● Character string: The
value of the property
field corresponding to
each vertex is used as the
initialization label (the
type is string, and the
initialization label field is
left blank for a vertex
with unknown labels).
This method is applicable
to scenarios where some
vertex labels are marked
to predict unknown
vertex labels.
NOTE
If the value of initial is a
character string, the number of
vertices with initialization
labels must be greater than 0
and less than the total number
of vertices.

NOTE

For details about algorithm iterations and convergence, see Iterations and Convergence of
PageRank.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 288
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-179 response_data parameter description


Parameter Type Description

communit List Community corresponding to each vertex. The format is


y as follows:
[{vertexId:communityId},...]
where
vertexId is of the string type.
communityId is of the string type.

5.1.6.2.21 Louvain

Table 5-180 parameters parameter description


Paramet Manda Descriptio Type Value Range Default
er tory n Value

converge No Convergen Double A real number 0.00001


nce ce between 0 and 1

max_iter No Maximum Integer An integer ranging 100


ations iterations from 1 to
2147483647. For
frontend calls, the
range is [1,2000].

weight No Weight of String Empty or null weight


an edge character string
● Empty: The
default weight
and distance of
edges are 1.
● Character string:
The property of
the
corresponding
edge is the
weight. If the
edge does not
have a property,
the weight is 1 by
default.
NOTE
The weight of an
edge must be greater
than 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 289
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

For details about algorithm iterations and convergence, see Iterations and Convergence of
PageRank.

Table 5-181 response_data parameter description

Param Type Description


eter

modula Double Modularity


rity

commu Integer Number of communities


nity_nu
m

commu List Community corresponding to each vertex. The format is


nity as follows:
[{vertexId:communityId},...]
where
vertexId is of the string type.
communityId is of the string type.

5.1.6.2.22 Node2vec

Table 5-182 parameters parameter description

Param Mand Description Type Value Range Default


eter atory Value

P No Rollback Doubl Greater than 0 1


parameter e

Q No Forward Doubl Greater than 0 1


parameter e

dim No Mapping Integ An integer ranging 50


dimension er from 1 to 200

walkLe No Random walk Integ An integer ranging 40


ngth length er from 1 to 100

walkNu No Number of Integ An integer ranging 10


mber random walk er from 1 to 100
steps of each
vertex.

iteratio No Number of Integ An integer ranging 10


ns iterations er from 1 to 100

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 290
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-183 response_data parameter description


Parameter Type Description

embedding List Vector representation of each vertex


mapped to the Euclidean space. The format
is as follows:
[{vertexId:vectorValue}]
where
vertexId is of the string type.
vectorValue: is a euclidean vector, for
example, [-0.485, -0.679, 0.356].

5.1.6.2.23 Real-time Recommendation

Table 5-184 parameters parameter description


Param Mandat Description Type Value Range Defa
eter ory ult
Valu
e

sources Yes Vertex ID. Multiple vertices Strin The number -


are supported. g of source
vertices
cannot
exceed the
upper limit
(30 by
default,
which can be
changed
using
source_limit)
. Use
commas (,)
to separate
the IDs.

alpha No Weight coefficient. A larger Dou A real 0.85


value indicates a longer ble number
step. between 0
and 1

N No Total number of walk steps Integ 1 to 200000 1000


er 0

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 291
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Mandat Description Type Value Range Defa


eter ory ult
Valu
e

nv No Parameter indicating that Integ 1 to 10 5


the walk process ends er
ahead of schedule:
minimum number of access
times of a potential
recommended vertex
NOTE
If a vertex is accessed during
random walk and the number
of access times reaches nv,
the vertex will be recorded as
the potential recommended
vertex.

np No Parameter indicating that Integ 1 to 2000 1000


the walk process ends er
ahead of schedule: number
of potential recommended
vertices
NOTE
If the number of potential
recommended vertices of a
source vertex reaches np, the
random walk for the source
vertex ends ahead of
schedule.

label No Expected type of the vertex Strin Vertex label -


to be output. g
NOTE
● Expected type of the
vertex to be output. If the
value is null, the original
calculation result of the
algorithm is output
without considering the
vertex type.
● If the value is not null,
vertices with the label are
filtered from the
calculation result.

directe No Whether to consider the Bool true or false true


d edge direction ean

source_ No Maximum number of Int 1~100000 30


limit source vertices

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 292
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Param Mandat Description Type Value Range Defa


eter ory ult
Valu
e

restrict No Whether to accept invalid Bool true or false true


ed source vertices
restricted=true: If a vertex
that does not exist in the
graph is passed to sources,
an error is reported.
restricted=false: A vertex
that does not exist in the
graph can be passed to
sources. However, if all
source vertices do not exist,
an error is reported.

Table 5-185 response_data parameter description


Parame Type Description
ter

score List Score of each vertex, which reflects the recommendation


degree. A larger value indicates a higher recommendation
degree. The format is as follows:
[{vertexId: scoreValue},...]
where
vertexId is of the string type.
scoreValue is of the double type.

sources List ID of the source vertex

5.1.6.2.24 Degree Correlation

Table 5-186 response_data parameter description


Parameter Type Description

degree_correlation Double Degree correlation

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 293
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.25 Triangle Count

Table 5-187 parameters parameter description


Paramet Manda Description Type Value Range
er tory

statistics No Whether to export only Boolea true or false. The


the total statistical result. n default value is
● true: Export only the true.
statistical result.
● false: Export the
number of triangles
corresponding to each
vertex.

Table 5-188 response_data parameter description


Parameter Type Description

triangle_count Integer Number of triangles

vertex_triangles List Number of triangles on each vertex.


The format is as follows:
[{vertexId : vertexTriangleCount},...],
where
vertexId is of the string type.
vertexTriangleCount is of the integer
type.

5.1.6.2.26 Cluster Coefficient

Table 5-189 response_data parameter description


Parameter Type Description

cluster_coefficient Double Cluster coefficient

statistics Boolean Whether to only return the global


average clustering coefficient. The
default value is true.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 294
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.27 Closeness Centrality

Table 5-190 parameters parameter description


Param Mandat Description Type Value Range Default
eter ory Value

source Yes ID of the vertex to String - -


be calculated

Table 5-191 response_data parameter description


Parameter Type Description

closeness Double Closeness centrality degree

source String Vertex ID to be calculated

5.1.6.2.28 Filtered Circle Detection

Request example
Post http://{}/ges/v1.0/1/graphs/movie/action?action_id=execute-algorithm
{
"algorithmName": "filtered_circle_detection",
"parameters": {
"n": 10,
"statistics": true,
"output_format":"edgeId"
},
"filters": [
{
},
{
"operator": "out",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "transfer"
}
}
},
"times":5
}
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 295
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameters

Table 5-192 parameters parameter description


Parameter Mand Description Type Value Default
atory Range Value

sources No Set of source vertex String - The value


IDs to be queried is in the
standard
CSV
format. IDs
are
separated
by commas
(,), for
example,
Alice,
Nana.

n No Upper limit of the Integ [1,100000] 100


number of er
enumerated circles
that meet the filter
criteria

statistics No Whether to export Boole true or false false


the number of an
circles that meet
the filter criteria

batch_num No Number of source Integ [1,1000] 10


ber vertices for batch er
processing

output_for No Output format String vertexId, edgeObject


mat edgeId, or
edgeObject

filters Yes Filter criteria. Each Objec - -


element in the t
array corresponds
to a filter.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 296
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-193 filters element formats


Paramete Man Description Type Value Range Default
r dato Value
ry

operator No Direction of the Strin out, in, or out


query to be g both
performed at the
current layer

edge_filter No Filter criteria for the Objec - -


current layer. For t
details, see Table
5-299 in the
Filtered-query API.

vertex_filt No Filter criteria of Objec - -


er vertices at the t
current layer. For
details, see Table
5-299 in the
Filtered-query API.

times No Number of layers Integ [1,10] 1


queried using the er
same filter criteria

NOTE

● Filter criteria at the first layer are used to filter source vertices. Therefore, only the
vertex_filter parameter is valid.
● Filter criteria at the last layer are used to filter source vertices.
● The circle length ranges from 3 to 10. Therefore, the number of filtering layers is 4 to
11.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 297
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-194 response_data parameter description


Parameter Mandat Type Description
ory

circles Yes List Set of circles found. The format is [[circle1],


[circle2], ...]. The circle format is as follows:
● If output_format is edgeObject, the
format is [{"source": sourceId, "target":
targetId, "index": edgeIndex}, ...],
where sourceId, targetId, and edgeIndex
are of the string type.
● If output_format is edgeId, the format is
[sourceId-targetId-edgeIndex,…],
where sourceId-targetId-edgeIndex is of
the string type.
● If output_format is vertexId, the format
is [vertexId, ...], where vertexId is of the
string type.

runtime Yes Double Algorithm running time

n Yes Integer Maximum number of enumerated circles

circle_num No Integer When statistics is set to true, the number


ber of circles that meet filter criteria is
displayed.

5.1.6.2.29 Subgraph Matching

Table 5-195 parameters parameter description


Parameter Manda Description Type Value Range
tory

edges Yes Edge set of the String The value is in


subgraph to be standard CSV format.
matched. The vertex The start and end
ID must be of the vertices of an edge are
size_t type. separated by a comma
(,), and edges are
separated by a newline
character (\n). For
example, 1,2\n2,3.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 298
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Description Type Value Range


tory

vertices Yes Label of each vertex String The value is in


on the subgraph to standard CSV format.
be matched. Vertices and their
labels are separated by
commas (,), and labels
are separated by
newline characters
(\n). For example, 1,BP
\n2,FBP\n3,CP.

directed No Whether to consider Boole The value can be true


the direction of the an or false. The default
graph value is true.

n No Maximum number of Intege The value range is


subgraphs to be r [1,100000]. The
searched for default value is 100.

batch_num No Number of queries Intege The value range is


ber processed in batches r [1,1000000]. The
each time default value is 10000.

statistics No Whether to display Boole The value can be true


the number of all an or false. The default
subgraphs that meet value is false.
the conditions

Table 5-196 response_data parameter description


Parameter Mand Type Description
atory

subgraphs Yes List Subgraphs with the same pattern of the


pattern_graph. The value is in the
[[subgraph1],[subgraph2], ...] format. Each
subgraph is in the [vertex1,vertex2, ...] format,
where vertex is of the string type. The vertices
of each subgraph correspond to those of
pattern_graph.

pattern_gra Yes List Graph pattern. The value is in the


ph [vertex1,vertex2, ...] format, where vertex is of
the string type.

subgraph_n No Intege Number of matched graphs. When statistics is


umber r set to true, the total number of graphs that
meet query conditions is displayed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 299
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.6.2.30 Topicrank

Table 5-197 parameters parameter description


Paramete Man Description Type Value Range Default
r dator Value
y

sources Yes Vertex ID. You can Strin Currently, a -


specify multiple g maximum of
node IDs in CSV 100000 IDs are
format and allowed.
separate them
with commas (,).

actived_p No Initial weight of Doub The value 1


the sources le ranges from 0
vertex. to 100000.

default_p No Initial weight of a Doub The value 1


non-source vertex le ranges from 0
to 100000.

filtered No Whether to filter Bool The value can false


results ean be true or
false.

only_neig No Whether to Bool The value can false


hbors display only the ean be true or
neighboring false.
vertices of the
sources

alpha No Weight Strin The value is a 0.85


coefficient g real number
between 0 and
1.

convergen No Convergence Strin The value is a 0.00001


ce g real number
between 0 and
1.

max_iterat No Maximum Integ An integer 1000


ions iterations er ranging from 1
to
2147483647.
For frontend
calls, the
range is
[1,2000].

directed No Whether the Bool The value can true


edges are ean be true or
directed false.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 300
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Man Description Type Value Range Default


r dator Value
y

num_thre No Number of Integ The value 4


ad threads er ranges from 1
to 40.

Table 5-198 response_data parameter description

Parameter Type Description

topicrank List TopicRank value of each vertex.


The format is as follows:
[{vertexId:rankValue},...],
where
vertexId is of the string type.
rankValue is of the double type.

5.1.7 Temporal Graph APIs

5.1.7.1 Community Evolution (temporal_graph)

Function
The community evolution algorithm generates a temporal graph that shows
structure changes of a community over time.

Figure 5-1 Principle

URL
POST /ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 301
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-199 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 5-200 Request body parameters


Parameter Mandatory Type Description

algorithmNa Yes String Algorithm name


me

dynamicRang Yes Object Temporal parameters


e

parameters Yes Object Algorithm parameters

Table 5-201 dynamicRange parameters


Parameter Mandatory Type Description

start Yes Date or Start time of the temporal analysis.


integer The start time must be earlier than
the end time.

end Yes Date or End time of the temporal analysis


integer

time_props Yes Object Time properties for the temporal


analysis

Table 5-202 time_props parameters


Parameter Mandatory Type Description

stime Yes String Property name of the start time

etime Yes String Property name of the end time

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 302
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-203 parameters


Parameter Mandatory Type Description

source Yes String Vertices in the community network.


You can specify a maximum of
100,000 vertices.

temporal_vert No Boolean Whether to perform community


ex evolution on a node. The default
value is false.

Response Parameters

Table 5-204 Parameters in a response


Parameter Mandatory Type Description

errorMessage No 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 No String System prompt. If execution


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

status No String Returned job status for a successful


query. Possible values are waiting,
running, and complete. If the query
fails, the field is empty.

data No JSON Algorithm execution result. If the


query fails, the field is empty.

Example Request
Observe the community evolution of some nodes. The algorithm name is
temporal_graph, the start time of dynamic analysis is ${startTime}, and the end
time is ${endTime}.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis
{
"algorithmName":"temporal_graph",
"dynamicRange":{
"start":"${startTime}",
"end":"${endTime}",
"time_props":{"stime":"${property(start_time)}","etime":"${property(start_time)}"}
},
"parameters":{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 303
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"sources":[],
"temporal_vertex":false
}
}

Example Response
Status code: 200
Example response for a successful request
{
"jobId": "f9987cab-64d3-4b3d-ac43-e91ae0c21bef168127124",
"jobType": 0
}

Status code: 400


Example response for a failed request
{
"errorMessage":"${errorMessage}",
"errorCode":"GES.8301"
}

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

5.1.7.2 Temporal BFS (temporal_bfs)

Function
This algorithm searches for associated vertices based on temporal message
passing and temporal BFS algorithms, and outputs the visit time of each vertex
and the distance from the vertex to the source start vertex.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 304
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Figure 5-2 Principle

URL
POST /ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis

Table 5-205 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 5-206 Request body parameters

Parameter Mandatory Type Description

algorithmNa Yes String Algorithm name


me

dynamicRang Yes String Temporal parameters


e

parameters Yes String Algorithm parameters

Table 5-207 dynamicRange parameters

Parameter Mandatory Type Description

start Yes Date or Start time of the temporal analysis


integer

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 305
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

end Yes Date or End time of the temporal analysis


integer

time_props Yes Object Time properties for the temporal


analysis

Table 5-208 time_props parameters


Parameter Mandatory Type Description

stime Yes String Property name of the start time

etime Yes String Property name of the end time

Table 5-209 parameters


Parameter Mandatory Type Description

source Yes String Start vertex ID

k No Integer Distance from the target vertices to


the start vertex. The value range is
[1, 100] and the default value is 3.

directed No Boolean Search direction. The value can be


true or false. The default value is
true.

Response Parameters

Table 5-210 Parameters in a response


Parameter Mandatory Type Description

errorMessage No 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 No String System prompt. If execution


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 306
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

status No String Returned job status for a successful


query. Possible values are waiting,
running, and complete. If the query
fails, the field is empty.

data No Json Algorithm execution result. If the


query fails, the field is empty.

Example Request
Specify a source vertex ID to search for associated vertices. The algorithm name is
temporal_bfs, the start time of dynamic analysis is ${startTime}, and the end
time is ${endTime}.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis
{
"algorithmName":"temporal_bfs",
"dynamicRange":{
"start":"${startTime}",
"end":"${endTime}",
"time_props":{"stime":"${property(start_time)}","etime":"${property(start_time)}"}
},
"parameters":{
"source":"",
}
}

Example Response
Status code: 200
Example response for a successful request
{
"jobId": "f9987cab-64d3-4b3d-ac43-e91ae0c21bef168127124",
"jobType": 0
}

Status code: 400


Example response for a failed request
{
"errorMessage":"${errorMessage}",
"errorCode":"GES.8301"
}

Status Code
Return Value Description

400 Bad Request Request error

401 Unauthorized Authorization failed

403 Forbidden No operation permissions

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 307
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

404 Not Found No resources found

500 Internal Server Error Internal server error

503 Service Unavailable Service unavailable

5.1.7.3 Temporal Paths

Function
This API is used to execute the temporal paths algorithm based on input
parameters.
Note: Only one temporal path that meets the conditions is returned between two
vertices.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis

Table 5-211 URI parameters


Parameter Mandat Type Description
ory

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 5-212 Request body parameters


Parameter Mandat Type Description
ory

algorithmNa Yes String Algorithm name


me

parameters Yes parameters Algorithm parameters. For details,


Object see the parameter description of
each algorithm.

dynamicRang Yes dynamicRan Temporal parameters


e ge Object

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 308
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-213 parameters

Parameter Mandat Type Description


ory

source Yes String Source vertex ID

targets Yes String Target vertex ID set. The value is in


CSV format. IDs are separated by
commas (,), for example,
Alice,Nana. The quantity cannot be
greater than 100000. The default
value is 1000.

directed No Boolean Whether to consider the edge


direction. The value can be true or
false. The default value is false.

k No Integer Maximum depth. The value ranges


from 1 to 100. The default value is
3.

strategy No String Algorithm policy. The value can be


shortest, foremost, or fastest.
(Note: fastest is not supported
currently.)
The default value is shortest.
● shortest: Runs the shortest
temporal paths algorithm to
return the temporal path with
the shortest distance.
● foremost: Runs the foremost
temporal paths algorithm to
return the temporal path that
reaches the target node as early
as possible.
● fastest: Runs the fastest
temporal paths algorithm to
return the temporal path that
takes the shortest time.

Table 5-214 dynamicRange

Parameter Mandat Type Description


ory

start Yes Date/ Integer Start time for temporal analysis

end Yes Date/ Integer End time for temporal analysis

time_props Yes time_props Time properties for temporal


Object analysis

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 309
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-215 time_props


Parameter Mandatory Type Description

stime Yes String Name of the start time property

etime Yes String Name of the end time property

Response Parameters

Table 5-216 Response parameters


Parameter Mandatory Type Description

errorMessage No 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 No String System prompt. If execution


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

jobId No String ID of the algorithm execution job.


This parameter is left blank if the
request fails.
NOTE
You can view the job execution status
and obtain the return result by querying
the job ID. For details, see Job
Management APIs.

jobType No Integer Job type. This parameter is left blank


if the request fails.

Example Request
Specify a source vertex ID to search for associated vertices. The algorithm name is
temporal_paths, the start time of dynamic analysis is 1646092800, the end time
is 1646170716, and the source vertex ID is Person00014.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?
action_id=execute-analysis
{
"algorithmName":"temporal_paths",
"dynamicRange":{
"start":1646092800,
"end":1646170716,
"time_props":

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 310
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{"stime":"startTime","etime":"endtime"}
},
"parameters":{
"source":" Person00014",

"targets":"Person00055,Person00058,Person00052,Person00061,Person00060,Place00032,Place00016,Place00
026,Place00015,Place00043",
"strategy":"shortest",
"directed":true
}
}

Example Response
Status code: 200

Example response for a successful request


{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400

Example response for a failed request


{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

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.

5.1.8 Path APIs

5.1.8.1 Querying Path Details

Function
This API is used to query the path details. All possible paths will be listed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 311
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/paths/action?action_id=query-
detail

Table 5-217 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

Example Request
Query path details. The paths to be queried are Ray, Lethal Weapon, and Alice.
Do not set the query direction.
post http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/paths/action?action_id=query-detail
{
"paths":[
[
"Ray",
"Lethal Weapon",
"Alice"
]
],
"directed":false
}

NOTE

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

Request Parameters

Table 5-218 Request body parameters

Parameter Mandatory Type Description

paths Yes List Set of paths to be queried

directed No Boolean Whether the querying path is


directional or non-directional:
true: directional
false: non-directional
default=false

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 312
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-219 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.


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

data Object Query results.


This parameter is left blank when the
query fails.

Table 5-220 data parameter description


Parameter Type Description

outputs Object Query results containing the paths

paths List Collection of paths that contain


detailed vertex and edge information,
in JSONArray format
NOTE
In the returned paths:
● If the vertex does not exist, the
corresponding position is {}.
● If there is no edge between vertices,
the corresponding position is {"edges":
[]}.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"outputs":{
"paths":[
[
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 313
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"id":"Ray",
"label":"user",
"properties":{
"Name":["Ray"],
"Gender":["M"],
"Age":["18-24"],
"Occupation":["college/grad student"],
"Zip-code":["90241"]
}
},
{
"edges":[
{
"source":"Ray",
"target":"Lethal Weapon",
"index":"1",
"label":"rate",
"properties":{
"Score":[2],
"Datetime":["2000-11-22 19:16:16"]
}
}
]
},
{
"id":"Alice",
"label":"user",
"properties":{
"Name":["Alice"],
"Gender":["F"],
"Age":["25-34"],
"Occupation":["academic/educator"],
"Zip-code":["79928"]
}
}
]
]
}
}
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8107"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 314
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Code
See Error Code.

5.1.8.2 Querying Tree Details

Function
After you input a vertex, a tree starting from the vertex is output, including nodes
and edges in the tree, and information about reachable paths. Parameters can be
the direction (out, in, and out and in), maximum number of hops, and edge
properties to be filtered.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=query-tree

Table 5-221 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Example Request
Post /ges/v1.0/{project_id}/graphs/test/action?action_id=query-tree
{
"executionMode": "sync",
"rootId": "0",
"maxDepth": 20,
"maxVertices": 5000,
"maxEdges": 10000,
"maxDegree": 1000,
"direction": "both",
"labelFilters": [
"edge",
"default"
],
"withVertex": true,
"withEdge": true
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 315
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-222 Request body parameters


Parameter Mandator Type Description
y

executionMod No String ● sync: synchronous


e ● async: asynchronous
The default value is async, indicating
asynchronous response.

rootId Yes String ID of the root node

maxDepth Yes Integer Tree depth, that is, the maximum


length of a path. The value ranges
from 1 to 20.

direction Yes String Possible values:


in: Query incoming edges.
out: Query outgoing edges.
both: Query edges in both directions.

labelFilters No Array of Whether to filter paths by label. The


Json default value is [].

maxVertices Yes Integer Maximum number of vertices that can


be obtained. The value ranges from 0
to 200,000 (excluding 0).

maxEdges Yes Integer Maximum number of edges that can


be obtained. The value ranges from 0
to 200,000 (excluding 0).

maxDegree No Long This parameter is used to access a


super node. When the number of
unidirectionally connected edges of an
accessed node is greater than
maxDegree, the next hop of the node
will not be accessed.

withVertex No Boolean Whether to output the vertex data.


The default value is true.

withEdge No Boolean Whether to output the edge data. The


default value is true.

NOTE

In asynchronous mode, vertex and edge data is output at the same time. Pagination is not
supported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 316
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-223 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.


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

data Object Query results. For details, see Table 5-224 and
Table 5-225.
This parameter is left blank when the query fails.

Table 5-224 Synchronous data parameter description


Parameter Type Description

vertices List Vertex result set. If no corresponding vertices are found, the
value of vertices is empty.

edges List Edge result set. If no corresponding edges are found, the
value of edges is empty.

Table 5-225 Asynchronous data parameter description


Parameter Type Description

jobId String ID of the algorithm execution job. This parameter


is left blank when the request fails.

jobType Integer Job type. This parameter is left blank when the
request fails.

Example Response
● Synchronous call
Status code: 200
Example response (successful request)
Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 317
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"data": {
"edges" : [
{
"index" : "0",
"label" : "edge",
"properties" : {
"_type" : [ "ACTED_IN" ],
"role" : [ "Neo" ]
},
"source" : "546",
"target" : "0"
},
...
],
"vertices" : [
{
"id" : "546",
"label" : "node",
"properties" : {
"_labels" : [ "Actor" ],
"d" : [ "" ],
"name" : [ "Keanu Reeves" ],
"personId" : [ "keanu" ],
"title" : [ "" ],
"year" : [ "" ]
}
},
...
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [test] is not found",
"errorCode": "GES.8808"
}

● Asynchronous call
Status code: 200
Example response (successful request)
{
"jobId": "aca63a57-55f9-4c6e-932f-bcd6b87f7ab4",
"jobType": 1
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "executionMode is not correct, it should be sync or async",
"errorCode": "GES.8808"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 318
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.1.8.3 Repeat-query API

Function
This API is used to cyclically perform traversal query based on certain exit
conditions.
For example, the Gremlin statement is as follows:
g.V('a','b').repeat(out('c')).times(2).emit().path()
g.V('label_1').repeat(out('label_2')).emit()

URL
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=repeat-query

Table 5-226 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Request Parameters
NOTE

The number of elements in each traversal cannot exceed 100 million.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 319
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-227 Request body parameters

Parameter Mand Type Description


description atory

executionMode No String sync: synchronous; async: asynchronous.


The default value is async, indicating
asynchronous mode.

vertices Yes Array of List of IDs of source vertices to be


Json queried

edges No Array of List of edges to be queried. Either this


Json parameter or vertices is selected. For
details, see edges element formats.

repeat Yes Array of Filter criteria for repeat queries. Each


Json element in the array corresponds to a
filter. For details about the format, see
repeat element formats.

until No Array of while/do looping mode. Stops


Json traversing the filter condition list. Each
element in the array corresponds to the
condition to be terminated at each layer
in the repeat. The filter type must be
the same as that of each layer in the
repeat. For example, the first layer is
vertex_filter. For details about the
format, see repeat element formats.

times No Integer Maximum number of steps. The default


value is 5 and the maximum value is 20.

query_type No String Possible values are Default,


SimpleSubgraph, SimpleEdges, and
Path.
● Default returns the query content.
This is the default mode.
● SimpleSubgraph returns the entire
submap, including only the ID and
label information of vertices and
edges.
● SimpleEdges returns all edges,
including only the ID and label
information of the edges.
● Path returns the path information,
that is, the set of paths.

emit No Boolean Whether to return all elements. The


default value is true. This parameter is
available only when query_type is set
to Default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 320
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-228 edges element formats


Parameter Mandatory Type Description

source Yes String Source vertex ID

target Yes String Target vertex ID

index Yes String Indexes of edges in the source edge


set

Table 5-229 repeat element formats


Parameter Mandatory Type Description

operator Yes String Query type. s are as follows: inV:


ingress; outV: egress.
bothV: ingress point.

vertex_filte No Json String It takes effect on the vertex of the next


r hop. For details, see Table
property_filter element format.

edge_filter No Json String Indicates the edge between point-to-


point vertices. For details, see Table
property_filter element format.

Table 5-230 repeat element formats


Paramete Mandatory Type Description
r

vertex_filt No Json String This parameter is optional when


er operator is set to inV, outV, or bothV.
For details about the format, see
property_filter element formats.

Table 5-231 property_filter element formats


Parameter Mandatory Type Description

leftvalue No String Left value of the string type. For


details, see leftvalue element
formats.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 321
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

properties Yes String Filter type. Possible values are = (equal


to), != (not equal to), < (less than), <=
(less than or equal to), > (greater
than), >= (greater than or equal to), &
(and), | (or), HAS/HASNOT (whether
a property exists), and CONTAIN/
NOTCONTAIN (whether the property
value contains the right value).
SUBSET: The right value is a subset of
the attribute value. IN/NOTIN: Check
whether the left value and right value
overlap.
PREFIX: The right value is the prefix of
the left value. FUZZY: Fuzzy match.
REGEX: Regular expression match.
SUBSTRING: The right value is the
substring of the left value.
CISUBSTRING: The substring is case-
insensitive.

rightvalue Yes String Right value. For details about the


format, see rightvalue element
formats.

Table 5-232 leftvalue element formats


Parameter Mandatory Type Description

label_nam No String If label is used as the filter criterion,


e set this parameter to labelName and
value of rightvalue to the label name.

property_n No String If property is used as the filter


ame criterion, set this parameter to the
property name and value of
rightvalue to the property value.

ID No String If the vertex ID is filtered, this


parameter is optional.

property_fi No String If predicate is set to & or |,


lter property_filter can be nested in
leftvalue and rightvalue.

degree No String Direction of vertex degree filtering


statistics. This parameter is optional.
The value can be both, in, or out.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 322
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-233 rightvalue element formats

Parameter Mandatory Type Description

value Yes String If label is used as the filter criterion,


the value is the label name. If
property is used as the filter criterion,
the value is the property name.

property_fil No String If predicate is set to & or |,


ter property_filter can be nested in
leftvalue and rightvalue.

Table 5-234 predicate application scenarios

predicate label_name id property_na Nested


me Filtering

& No No No Yes

| No No No Yes

HAS/HASNOT No No Yes No

=/! Yes Yes Yes No


=/</<=/>/>=

Response Parameters

Table 5-235 Response body parameters

Parameter Type Description


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.


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

data Object Query results This parameter is left blank when


the query fails.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 323
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-236 data parameter description


Parameter Type Description
description

source String Source vertex ID

target String Target vertex ID

index String Edge index

label String Edge label

Example Request
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=repeat-query
{
"executionMode": "async",
"repeat": [
{
"operator": "outV",
"vertex_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "rate"
}
}
}
}
],
"until": [
{
"vertex_filter": {
"property_filter": {
"leftvalue": {
"property_name": "movieid"
},
"predicate": "=",
"rightvalue": {
"value": "1"
}
}
}
}
],
"emit": false,
"vertices": [
"tr_10","tr_11"
]
}

NOTE

The preceding request is equivalent to the following Gremlin statement:


g.V('tr_10','tr_11').repeat(out().hasLabel('rate')).until(has('movieid','1')).dedup()

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 324
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response for a successful request


{
"data":{
"edges":[
{
"index":"1",
"source":"tr_1",
"label":"rate",
"properties":{
"Rating":[
0
],
"Datetime":[
""
]
},
"target":"tr_3"
},
{
"index":"199998",
"source":"tr_1",
"label":"rate",
"properties":{
"Rating":[
0
],
"Datetime":[
""
]
},
"target":"tr_200000"
}
]
}
}

Status code: 400


Example response for a failed request
HttpStatusCode:400
{
"errorMessage":"graph [tesdt_117] is not found",
"errorCode":"GES.8806"
}

Status Codes
Response Code 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 325
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.1.9 Graph Statistics APIs

5.1.9.1 Querying General Information About a Graph

Function
This API is used to query the general information about a graph, such as the
numbers of vertices and edges.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/summary?
label_details={labelDetails}

Table 5-237 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

labelDetails No Boolean Whether to return


the number of
vertices and edges
under each label.
The default value
is false. If this
parameter is set
to true, the
numbers of
vertices and edges
under each label
are returned.

Request Parameters
None

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 326
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-238 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

data Object Query results. This parameter is left blank when the
request fails.

Table 5-239 data parameter description


Parameter Type Description

vertexNum Integer Number of vertices in a graph

edgeNum Integer Number of edges in a graph

labelDetails Object Numbers of vertices and edges under each label. To


properly display this parameter, create vertex and
edge indexes based on Table 5-240.

Table 5-240 Description of each element in labelDetails when the execution is


successful
Parameter Type Description

labelInVertex Object Number of vertices under each label. If the number


of vertices under a label is 0, the label is not
displayed.
To include this parameter in the response, create an
index by referring to Creating an Index. During
index creation, set indexType to GlobalComposite-
VertexIndex, set hasLabel to true, and leave
indexProperty blank.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 327
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

labelInEdge Object Number of edges under different labels. If the


number of edges under a label is 0, the label is not
displayed.
To include this parameter in the response, create an
index by referring to Creating an Index. During
index creation, set indexType to
GlobalCompositeEdgeIndex, set hasLabel to true,
and leave indexProperty blank.

errorMessag String System prompt.


e ● 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.

Example Request
Query general information about a graph, such as the numbers of vertices and
edges. The value true indicates that the numbers of vertices and edges of
different labels are returned.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/summary?label_details=true

NOTE

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

Example Response
Status code: 200
● Response example 1 of a successful request (The numbers of vertices and
edges under each label are returned.)
Http Status Code: 200
{
"data": {
"vertexNum": 146,
"labelDetails": {
"labelInVertex": {
"movie": 46,
"user": 100
},
"labelInEdge": {
"default": 450,
"rate": 1209
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 328
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

},
"edgeNum": 1659
}
}

● Response example 2 of a successful request (The numbers of vertices and


edges under each label fail to be returned.)
Http Status Code: 200
{
"data": {
"vertexNum": 146,
"labelDetails": {
"errorMessage": "Label index in vertices is not found.Label index in edges is not found.",
"errorCode": "GES.8017"
},
"edgeNum": 1659
}
}

● Example response 3 of a successful request (Only the number of vertices


under each label is returned.)
Http Status Code: 200
{
"data": {
"vertexNum": 146,
"labelDetails": {
"errorMessage": "Label index in edges is not found.",
"labelInVertex": {
"movie": 46,
"user": 100
},
"errorCode": "GES.8017"
},
"edgeNum": 1659
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8001"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 329
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.1.9.2 Querying the Graph Version

Function
This API is used to query the graph version.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/version

Table 5-241 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
None

Response Parameters

Table 5-242 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 330
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

version String Query results. This parameter is left blank when


the request fails.

Example Request
Query the graph version.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/version

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"version":"2.0.0"
}

Status code: 400


Example response (failed request)
Http Status Code: 404
{
"errorMessage":"Not found. Please check the input parameters.",
"errorCode": "GES.8000"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 331
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.10 Graph Operation APIs

5.1.10.1 Importing a Graph

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-graph

Table 5-243 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_nam Yes String Graph name


e

Request Parameters

Table 5-244 Request body parameters

Parameter Mandatory Type Description

edgesetPath No String Edge file directory or name

edgesetFormat No String Format of the edge data set.


Currently, only the CSV format
is supported.
The CSV format is used by
default.

vertexsetPath No String Vertex file directory or name

vertexsetFormat No String Format of the vertex data set.


Currently, only the CSV format
is supported.
The CSV format is used by
default.

schemaPath No String OBS path of the metadata file


of the new data

logDir No String Directory for storing logs of


imported graphs. This directory
stores the data that fails to be
imported during graph creation
and detailed error causes.

parallelEdge No Object Repetitive edge processing

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 332
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.
● allow indicates that
repetitive edges are allowed.
● ignore indicates that
subsequent repetitive edges
are ignored.
● override indicates that the
previous repetitive edges are
overwritten.

ignoreLabel No Boolean Whether to ignore labels on


repetitive edges. The value is
true or false, and the default
value is true.
● true: Indicates that the
repetitive edge definition
does not contain the label.
That is, the <source vertex,
target vertex> indicates an
edge, excluding the label
information.
● false: Indicates that the
repetitive edge definition
contains the label. That is,
the <source vertex, target
vertex, label> indicates an
edge.

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 333
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

offline No Boolean Whether offline import is


selected. The value is true or
false, and the default value is
false.
● true: Offline import is
selected. The import speed is
high, but the graph is locked
and cannot be read or
written during the import.
● false: Online import is
selected. Compared with
offline import, online import
is slower. However, the graph
can be read (cannot be
written) during the import.

obsParameters Yes Object OBS parameters

Table 5-245 obsParameters parameters


Parameter Mandatory Type Description

accessKey Yes String User AK

secretKey Yes String User SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Response Parameters

Table 5-246 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 334
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

jobId String ID of an asynchronous job


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

Example Request
Import a graph. The edge file directory is testbucket/demo_movie/edges/ and
the edge data set format is CSV; the vertex file directory is testbucket/
demo_movie/vertices/ and the vertex data set format is CSV; the OBS path of the
metadata file of the new data is testbucket/demo_movie/
incremental_data_schema.xml and the log storage directory is testbucket/
importlogdir.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-graph
{
"edgesetPath": "testbucket/demo_movie/edges/",
"edgesetFormat": "csv",
"vertexsetPath": "testbucket/demo_movie/vertices/",
"vertexsetFormat": "csv",
"schemaPath": "testbucket/demo_movie/incremental_data_schema.xml",
"logDir": "testbucket/importlogdir",
"parallelEdge": {
"action":"override",
"ignoreLabel":true
},
"delimiter": ",",
"trimQuote": "\"",
"offline": true,
"obsParameters": {
"accessKey": "xxxxxx",
"secretKey": "xxxxxx"
}
}

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400


Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 335
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorCode": "GES.8013",
"errorMessage": "graph [movie2] is not found"
}

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.

5.1.10.2 Exporting a Graph


NOTE

If you choose to export CSV files to your local host, the files are opened using the
spreadsheet software by default. You are advised to open the files in a text editor. If the
data contains special characters such as plus signs (+), minus signs (-), equal signs (=), and
at signs (@), the data will be parsed into formulas by the software. To ensure system
security, pay attention to the following when opening such files:
1. Do not select Enable Dynamic Data Exchange Server Launch (not recommended).
2. Do not select Enable or Yes if a dialog box indicating a security issue is displayed.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=export-graph

Table 5-247 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_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 336
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-248 Request body parameters


Parameter Mandatory Type Description

graphExportPath Yes String OBS path to which a


graph is exported

edgeSetName Yes String Name of the exported


edge data set

vertexSetName Yes String Name of the exported


vertex data set

schemaName Yes String Name of the exported


metadata file

obsParameters Yes String OBS parameters

accessKey Yes String User AK

secretKey Yes String User SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Response Parameters

Table 5-249 Response body parameters


Parameter Type Description

errorMessa String System prompt.


ge ● 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.

jobId String ID of an asynchronous job


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 337
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
● Example request
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=export-graph
{
"graphExportPath": "demo_movie/",
"edgeSetName": "set_edge.csv",
"vertexSetName": "set_vertex.csv",
"schemaName": "set_schema.xml",
"obsParameters": {
"accessKey": "xxxxxx",
"secretKey": "xxxxxx"
}
}

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorCode": "GES.8011",
"errorMessage": "graph [movie2] is not found"
}

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.

5.1.10.3 Clearing a Graph

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=clear-graph

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 338
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-250 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_nam Yes String Graph name


e

Request Parameters

Table 5-251 Request body parameter


Parameter Mandatory Type Description

clearMetadata No Boolean Whether to clear schema


data. The default value is
false.

Response Parameters

Table 5-252 Response body parameters


Parameter Mandator Description
y

errorMessa No System prompt.


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

errorCode No System prompt code.


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

jobId No ID of an asynchronous job


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 339
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Clear a graph by deleting its schema data.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=clear-graph
{
"clearMetadata": true
}

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorCode": "GES.8012",
"errorMessage": "graph [movie2] is not found"
}

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.

5.1.11 Subgraph Operation APIs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 340
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.11.1 Querying a Subgraph

Function
This API is used to query the subgraphs formed by the entered vertices and edges
between the vertices.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/subgraphs/action?
action_id=query

Table 5-253 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_nam Yes String Graph name


e

Request Parameters

Table 5-254 Request body parameter

Param Mand Type Description


eter atory

vertice Yes String Vertex ID array of the subgraph


s NOTE
The maximum number of vertices that can be entered is
100,000. If the number of vertices exceeds this limit, an
error is reported.

Response Parameters

Table 5-255 Response body parameters

Parameter Type Description

errorMessa String System prompt.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 341
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

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.

data Object The data field is contained when the query is


successful, and the data field contains the subgraph
query result.
NOTE
The maximum number of subgraph edges that can be
returned is 100,000. If the number of edges exceeds this
limit, an error is reported.

Example Request
Query the subgraphs formed by the entered vertices and edges between the
vertices. The subgraph vertex IDs are Ray, Ella, and Lethal Weapon.
{
"vertices":[
"Ray",
"Ella",
"Lethal Weapon"
]
}

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data":{
"vertices":[
{
"id":"Ray",
"label":"user",
"properties":{
"Name": ["Ray"],
"Gender":["M"],
"Age":["18-24"],
"Occupation":["college/grad student"],
"Zip-code":["90241"]
}
},
{
"id":"Ella",
"label":"user",
"properties":{
"Occupation":["other or not specified"],
"Name": ["Era"],
"Zip-code":["94402"],
"Gender":["F"],
"Age":["25-34"]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 342
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

}
],
"edges":[
{
"source":"Ray",
"target":"Lethal Weapon",
"index":"1",
"label":"rate",
"properties":{
"Score":[2],
"Datetime":["2000-11-22 19:16:16"]
}
},
{
"index":"0",
"source":"Ella",
"label":"rate",
"properties":{
"Score":[5],
"Datetime":["2000-11-23 02:30:29"]
},
"target":"Lethal Weapon"
},
{
"index":"5",
"source":"Ella",
"label":"friends",
"properties":{},
"target":"Ray"
}
]
}
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": " Bad Request, parameter vertices cannot be null",
"errorCode": "GES.8214"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 343
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.11.2 Executing an Algorithm on a Subgraph

Introduction
This API is used to adjust the subgraph creation type based on the input and
executes an algorithm on the generated subgraph.

URL
POST /ges/v1.0/{project_id}/graphs/{graph_name}/subgraphs/action?
action_id=execute-algorithm

Parameters
Paramet Mandator Type Description
er y

project_i Yes String Project ID. For details about how to obtain
d the project ID, see Obtaining a Project
ID.

graph_na Yes String Graph name


me

Request Parameters

Table 5-256 Request body parameters


Parameter Mandatory Type Description

algorithmNa Yes String Algorithm name


me Available values are as follows:
● connected_component
● kcore

parameters Yes JSON Algorithm parameters


● connected_component
● Kcore

subgraphCre Yes Object Subgraph parameters For details, see


ator subgraphCreator parameters.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 344
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-257 subgraphCreator parameters


Parameter Mandat Type Description
ory

name No String Type of the subgraph creator.


Currently, only filtered is available.

parameters Yes JSON The parameter format varies according


to the name of the subgraph creator.

Table 5-258 Parameters when name=filtered


Parameter Mandato Type Description
ry

vertex_filter No String Vertex filtering criteria

edge_filter No String Edge filtering criteria

Response Parameters

Table 5-259 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

jobId String ID of the algorithm execution job. This


parameter is left blank if the request fails.
NOTE
You can view the job execution status and obtain
the return result by querying the job ID. For
details, see Job Management APIs.

jobType Integer Task type. This parameter is left blank if the


request fails.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 345
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Execute a specific algorithm on a generated subgraph. The algorithm name is
connected_component, and the subgraph generator type is filtered.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/subgraphs/action?
action_id=execute-algorithm
{
"algorithmName":"connected_component",
"subgraphCreator": {
"name": "filtered",
"parameters": {
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "PHYSICAL_LINK"
}
}
}
}
},
"parameters":{
"num_thread":4
}
}

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 346
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes.

5.1.12 Job Management APIs

5.1.12.1 Querying Job Status on the Service Plane

Function
This API is used to query the execution status of a job. After asynchronous APIs
such as those for querying vertices and edges or executing algorithms are used,
job IDs are returned. You can use the job ID to query the execution status of a job.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/status?
offset=offset&limit=limit

Table 5-260 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.

job_id Yes String Job ID

offset No Integer Offset of a query. The default value


is 0.

limit No Integer Maximum number of records that


can be queried. The default value is
100000.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 347
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-261 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.

status String Returned job status after the query is


successful. Possible values:
● pending
● running
● success
● failed
This parameter is left blank when the query
fails.

data Object Algorithm execution result. This parameter is


left blank when the query fails.

Table 5-262 data parameter description


Parameter Type Description

vertices List Vertex-associated algorithm result

edges List Edge-associated algorithm result

outputs Object Other results

data_return_ Integer Number of records returned after a query


size

data_offset Integer Result offset of a query

data_total_si Integer Total amount of result data generated by


ze asynchronous jobs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 348
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Query the execution status of a job. The query offset is 0, and the maximum
number of returned results is 2.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/status?offset=0&limit=2

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"data": {
"outputs": {
"data_return_size": 2,
"vertices": [
{
"id": "Sarah",
"label": "user",
"properties": {
"Occupation": [
"other or not specified"
],
"Name": [
"Sarah"
],
"Zip-code": [
"55105"
],
"Gender": [
"F"
],
"Age": [
"18-24"
]
}
},
{
"id": "Sidney",
"label": "user",
"properties": {
"Occupation": [
"writer"
],
"Name": [
"Sidney"
],
"Zip-code": [
"85296"
],
"Gender": [
"M"
],
"Age": [
"18-24"
]
}
}
],

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 349
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"data_offset": 0,
"data_total_size": 19
}
},
"status": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

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.

5.1.12.2 Canceling a Job

Function
This API is used to cancel a job that has been submitted.

NOTE

Only jobs returned by the following APIs can be canceled: exporting a graph, importing a
graph, querying vertices that meet filter criteria, querying edges that meet filter criteria,
edge filtering query, Filtered-query V2, executing an algorithm, and adding an index.

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 350
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-263 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.

job_id Yes String Job ID

graph_name Yes String Graph name

Request Parameters
For details, see the URI parameters.

Response Parameters

Table 5-264 Response body parameters


Parameter Type Description

errorMessa String System prompt.


ge ● 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.

Example Request
Cancel a job that has been submitted.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}

NOTE

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

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 351
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response (successful request)


Http Status Code: 200
{}

Status code: 400

Example response (failed request)


Http Status Code: 400
{

"errorMessage": "can not find job to cancel, id is 9440a7ebXXXXXXXXXXXXXXXXXXXX2d079a67001679122",

"errorCode": "GES.8303"
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found The requested resource was not found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Error Code
See Error Code.

5.1.12.3 Exporting Job Execution Results to Files

Function
This API is used to export the execution result (result) of an asynchronous job
(jobId) to a file.

● The following algorithms are supported:


– PageRank, PersonalRank, and Pixie
– Louvain, Label Propagation, and Connected Component
– K-Core
– SSSP, Shortest Path (including Time Window Shortest Path), Shortest Path
of Vertex Sets, All Shortest Paths, and n Paths
– Triangle Count, Cluster Coefficient, Degree Correlation, and Closeness
– Link Prediction
– Betweenness, edge_betweenness, and od_betweenness

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 352
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

● The following queries are supported:


– Cypher Operation APIs
– Querying Vertices That Meet Filter Criteria
– Querying Edges That Meet Filter Criteria

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/action?
action_id=export-result

Table 5-265 URI parameters


Parame Mandat Type Description
ter ory

project_i Yes String Project ID. For details about how to obtain the
d project ID, see Obtaining a Project ID.

graph_n Yes String Graph name


ame

job_id Yes String ID of the job corresponding to the response

Request Parameters

Table 5-266 Request body parameters


Parameter Mandator Type Description
y

exportPath Yes String Export path

fileName No String Name of the exported file

obsParame Yes String OBS authentication parameters. For details,


ters see Table 5-267.

paginate No Object Pagination parameter. By default,


pagination is disabled for the asynchronous
task export API. For details, see Table
5-268.

erase No Boolea Specifies whether to delete the original job


n after the export. The value can be true or
false. The default value is true, indicating
that the job is deleted and resources are
released by default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 353
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-267 obsParameters parameter description

Parameter Mandator Type Description


y

accessKey Yes string AK

secretKey Yes string SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Table 5-268 Elements in paginate

Parameter Mandator Type Description


y

enable No Bool Whether to enable pagination. The


default value is false. To enable
pagination, set this parameter to true.

rowCountP No Int Maximum number of rows in each file


erFile when graphs are exported by page.
The default value is 10000000.

numThread No Int Number of concurrent threads when


graphs are exported by page. The
default value is 8.

maxSizePer No Int Maximum size of each file when


File execution results are exported by
page, in bytes.

● paginate parameter description


a. When pagination is enabled, fileName in the request body indicates the
directory name, and the directory is used to store pagination files. When
pagination is disabled, fileName indicates the file name. Before the
export, ensure that the path the file name points to is empty so that the
existing data on OBS will not be overwritten during the export.
b. If the value of numThread is greater than the number of vCPUs used by
the GES graph instance, the parameter is set to the number of vCPUs.
c. The rowCountPerFile value affects the number of actually used threads.
That is, when the ratio of the result set size to rowCountPerFile is less
than numThread, the ratio is used as the value of numThread.
d. If the request is canceled by the user, the data uploaded to OBS will not
be deleted. For details about the API for canceling jobs, see Canceling a
Job.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 354
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

● When the pagination function is enabled, the file name is named as follows:
If enable in the paginate parameter is set to true, fileName indicates a
directory. Files in the directory are named using the combination of the thread
ID and file number, and are separated by a period (.). For example, for 3.2
million data records, the examples of the first and last file names in different
configurations are as follows:

rowCountPerFil 100,000 100,000 1 million 1 million 5 million


e

numThread 2 48 2 5 2

Threads 2 32 2 4 1
Actually Used

Files Generated 16 1 2 1 1
by a Single
Thread

First File Name 00.000.csv 00.000.cs 00.00.csv 00.00.csv 00.00.csv


v

Last File Name 01.015.csv 031.000.c 01.01.csv 03.00.csv 00.00.csv


sv

To export the data of a ten-billion-vertex graph on multiple nodes at the


same time, use the host ID as the prefix of the file name.

Response Parameters

Table 5-269 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

jobId String ID of an asynchronous job.


You can view the job execution status and obtain
the return result by querying the job ID. For
details, see Querying Job Status on the Service
Plane (1.0.0).

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 355
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
● Example request 1: Export the execution results of an asynchronous job to an
OBS file. The export path is demo_movie/. The name of the exported file is
louvain. After the export, the original job is deleted.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/action?action_id=export-result
{
"exportPath": "demo_movie/",
"fileName": "louvain",
"erase": true,
"obsParameters": {
"accessKey": "xxxx",
"secretKey": "xxxx"
}
}
● Example request 2: Export the execution result of an asynchronous job to an
OBS file. The export path is demo_movie/. The name of the exported file is
louvain. By default, pagination is disabled. When data is exported by page,
the maximum number of rows in each file is 100,000.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/action?action_id=export-result
{
"exportPath": "demo_movie/",
"fileName": "louvain",
"paginate":{
"enable":true,
"numThread":2,
"rowCountPerFile":100000
},
"obsParameters": {
"accessKey": "xxxx",
"secretKey": "xxxx"
}
}

NOTE

Currently, Cypher statements can only be used to export common value types, such as
attribute values, numbers, and strings, but not composite value types (such as lists
and maps), vertices, or edges. For example:
● The results of the following statements can be exported:
match (n) return id(n) limit 10
match (n) return n.age, n.occupation
match (n)-[r]->(m) return n.Rating limit 10
unwind [1,2,3] as p return p
● The exported CSV file contains null values or blank lines because the results of the
following statements contain objects or compound values:
return [1,2,3], {a:1}
match (n) return n limit 10
match (n)-[r]->(m) return r limit 10

Example Response
Status code: 200
Example response (successful request)
HttpStatusCode: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 356
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Example response (failed request)


HttpStatusCode: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8011"
}

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.

Exporting the Result in CSV File


1. The following is an example of the algorithm execution result, for example,
content of Louvain.csv:
# modularity: 0.4269691347613425,
#community_num: 4,
#runtime: 0.003784,
#data_total_size: 34
#community:
1,1
2,1
...

2. The following is an example Cypher query result:


– Example 1
Query statement:
match (n:user)-[r]->(m:movie) return id(n),n.Name, n.Occupation, n.Age,r.Score,m.Title

Result:
#data_total_size:1209
#data_return_size:1209
#data_offset:0
#records:
Vivian, artist, 25-34, 5, Lethal Weapon
Vivian, Artist, 25-34, 4, Raising Arizona
Mercedes, K-12 student, Under 18, 3, Lethal Weapon

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 357
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Mercedes, K-12 student, Under 18, 3, The Rock


...

– Example 2
Query statement:
match (n)-->(m) where id(n)='Vivian' return labels(m),count(*)

Result:
#data_total_size:2
#data_return_size:2
#data_offset:0
#records:
user,5
movie,2

5.1.12.4 Querying the Job List

Function
After the ID of an asynchronous job is returned, if the job ID at the service layer is
lost and cannot be obtained through the API, a new API is provided to query all
asynchronous jobs stored in the engine. The job ID, job status, and original request
of each job are returned.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/status?
limit={limit}&offset={offset}

Table 5-270 URI parameters


Parame Mandat Type Description
ter ory

project_i Yes String Project ID. For details about how to obtain the
d project ID, see Obtaining a Project ID.

offset No Integer Offset of a query. The default value is 0.

job_id Yes String ID of the job corresponding to the response

limit No Integer Maximum number of records that can be


queried. The default value is 100000.

Request Parameters
For details, see the URI parameters.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 358
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-271 Response body parameters


Parameter Type Description

errorMessa String System prompt.


ge ● 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 Query result. If the query is successful, the


value is success. If the query fails, the value is
failed.

jobs Object Job status list stored in the system. If execution


succeeds, this parameter is contained in the
response. Table 5-272 describes the structure
of a single jobs field.

Table 5-272 Job status structure


Parameter Type Description

jobId String Job name.

request Object Request content, including the command, URL,


and body.

status String Job status. The value can be pending, running,


or complete.

Example Request
Query the job list and return the job ID and status of each job.
GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/status?limit={limit}&offset={offset}

Example Response
Status code: 200
Example response for a successful request
{
"jobs": [

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 359
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"jobId": "527e0c2e-57ee-4c23-8cf7-baff8049c6b9001234245",
"rawRequest": "{\"graphName\":\"ges_yiwan_jimengke\",\"offline\":false,\"edgesetPath\":\"/
user/ges/data/ranking_edge.csv\",\"vertexsetPath\":\"/user/ges/data/movies_vertex_new.csv\",\"delimiter
\":\",\",\"trimQuote\":\"\\\"\",\"vertexsetFormat\":\"csv\",\"parallelEdge\":{\"ignoreLabel\":true,\"action
\":\"allow\"},\"edgesetFormat\":\"csv\"}",
"taskType": "ImportGraph",
"canStop": false,
"progress": "100",
"files": [
{
"edgeFiles": [
{
"fileName": "/user/ges/data/ranking_edge.csv",
"totalLines": 1659,
"startTime": 1707201116130344,
"successfulLines": 1659,
"endTime": 1707201116149714,
"status": "success",
"failedLines": 0
}
]
},
{
"vertexFiles": [
{
"fileName": "/user/ges/data/movies_vertex_new.csv",
"totalLines": 146,
"startTime": 1707201115842346,
"successfulLines": 146,
"endTime": 1707201115876634,
"status": "success",
"failedLines": 0
}
]
}
],
"startTime": "2024-02-06 14:31:55",
"endTime": "2024-02-06 14:31:56",
"status": "success"
},
{
"jobId": "9d43e7a1-bfc5-4990-b494-01c31098523e001234245",
"rawRequest": "{\"graphName\":\"ges_yiwan_jimengke\",\"offline\":false,\"edgesetPath
\":\"\",\"vertexsetPath\":\"\",\"delimiter\":\",\",\"schemaPath\":\"/user/ges/data/movie_schema.xml
\",\"trimQuote\":\"\\\"\",\"vertexsetFormat\":\"csv\",\"parallelEdge\":{\"ignoreLabel\":true,\"action\":\"allow
\"},\"edgesetFormat\":\"csv\"}",
"taskType": "ImportGraph",
"canStop": false,
"progress": "100",
"files": [
{
"schemaFiles": [
{
"totalLabels": 4,
"fileName": "/user/ges/data/movie_schema.xml",
"failedLabels": 0,
"startTime": 1707201113260909,
"successfulLabels": 4,
"endTime": 1707201113369960,
"status": "success"
}
]
}
],
"startTime": "2024-02-06 14:31:45",
"endTime": "2024-02-06 14:31:53",
"status": "success"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 360
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

],
"jobCount": 2
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{
"errorMessage": "graph : movidde not exist",
"errorCode": "GES.8000",
"result": "failed"
}

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.

5.1.13 Custom Operations APIs

5.1.13.1 Performing Custom Operations

Function
This API is used to perform a specified custom operation.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
operation

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 361
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-273 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 5-274 Request body parameters

Parameter Mandatory Type Description

api Yes String Available APIs used by the custom


operation.

command Yes String Command executed by the custom


operation.

Response Parameters

Table 5-275 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.

data json Execution result of the custom operation. This


parameter is left blank if the request fails.

Example Request
Perform a specified custom operation. The API used for the custom operation is
gremlin, and the command is {\"command\": \"g.V('1')\"}.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 362
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-operation
{
"api": "gremlin",
"command": "{\"command\": \"g.V('1')\"}"
}

Example Response
Status code: 200

Example response (successful request)


{
"data":{
"vertices":[
{
"id":"1",
"label":"movie",
"properties":{
"genres":[
"Comedy"
],
"movieid":[
1
],
"title":[
"Airplane! (1980)"
]
}
}
],
"runtime":0.126476598
}
}

Status code: 400

Example response (failed request)


Internal Server Error
{
"errorCode":"GES.8814",
"errorMessage":"Unsupported API."
}

Status Code
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authentication failed.

403 Forbidden No operation permission.

404 Not Found No resources found.

500 Internal Server Error Internal service error.

503 Service Unavailable Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 363
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Code
See Error Code.

5.1.14 Cypher Operation APIs

5.1.14.1 Executing Cypher Queries

Function
Cypher is a widely used declarative graph database query language. It can be used
to query data in GES and returns results. Graph statistics are used in Cypher
implementation. Currently, the label-based vertex and edge indexes are used
during Cypher query and compilation. To use Cypher normally, create indexes by
referring to Cypher Prerequisites.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
cypher-query

Table 5-276 URI parameters

Parameter Mandat Type Description


ory

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Example Request
Execute a Cypher query. The Cypher statement is match (n) return n limit 1. The
returned results are in the format that each element corresponds to a field in the
row.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-cypher-
query
{
"statements": [{
"statement": "match (n) return n limit 1",
"parameters": {},
"resultDataContents": ["row"],
"includeStats": false
}]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 364
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-277 Request body parameter


Parameter Manda Type Description
tory

statements Yes List Statement group that contains one


or more statements. The
statements parameters table
describes the format of each
element.

Table 5-278 statements parameters


Parameter Manda Type Description
tory

statement Yes String Cypher statement

parameters Yes Object Cypher statement parameters, which


are used for parameterized queries. By
default, this field is left blank.
For details, see parameterized
queries.

resultDataContent No String or Format of the returned result. You can


s List set one or more formats. Available
values are row, graph, and raw
(added in version 2.2.27).

includeStats No Boolean Whether the returned result contains


addition, deletion, and modification
statistics. If this parameter is not set,
the returned result does not contain
the information by default.

runtime No String Executor type. The value can be map


or slotted. The default value is map.
NOTE
1. The slotted executor is supported since
version 2.3.14.
2. Compared with the map executor, the
slotted executor completes more
statement data flow analysis in the
plan generation phase of statements.
In most cases, it executes faster while
requiring less memory.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 365
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Type Description


tory

executionMode No String Execution mode. Set this parameter to


(2.2.23) sync for synchronous execution and
to async for asynchronous execution.
If this parameter is not set, the
execution is synchronous by default.
For details about how to obtain the
query result in asynchronous mode,
see Querying Job Status on the
Service Plane.

limit (2.2.23) No Int Maximum number of results of the


asynchronous query. This parameter is
valid only when executionMode is
sync. The default value is 100000.

NOTE

● You can add the explain and profile prefixes before the statement to display the query
plan.
● explain displays only the query plan but does not execute the statement.
● profile displays the query plan and executes the statement.
● In asynchronous mode (executionMode is async), cypher query results can be exported
to CSV files (GES 2.3.4 or later supports this function). For details, see Exporting Job
Execution Results to Files. Currently, the following values can be returned:
1. Vertex and edge single-value properties, vertex and edge IDs, and group counts.
2. The current version does not support exporting object types. Objects are converted
to null values in the CSV file.

Response Parameters

Table 5-279 Response body parameters

Parameter Type Description

results List Each element of the list is the return result of a


Cypher statement.

errors List Each element in the list contains the code and
message information in string form.

Table 5-280 Elements of the results parameter

Parameter Type Description

columns List Name of a returned field

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 366
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

data List Returned data value. Each element indicates a


record.

stats Object Addition, deletion, and modification statistics

plan Object If the Cypher statement contains the explain or


profile prefix, this field contains the query plan.
Otherwise, this field is not displayed. The profile
feature is supported since version 2.3.12.

jobId(2.3.10) String Asynchronous job ID if the request is executed


asynchronously

jobType(2.3.1 Integer Type of the asynchronous job if the request is


0) executed asynchronously

Table 5-281 Elements of the data parameter


Parameter Type Description

row List Content of a specific row. Each element


corresponds to a field in the row. This parameter
is displayed only when resultDataContents is
empty or contains row.

meta List Type of each field in a row. This parameter is


displayed only when resultDataContents is
empty or contains row.

graph Object Information returned in graph format. This


parameter is displayed only when
resultDataContents contains graph.

raw(2.2.27) List Information returned in raw format. This


parameter is displayed only when
resultDataContents contains raw.

Table 5-282 stats elements in a response


Parameter Type Description

contains_upd Boolean Whether data is modified during the query


ates

edges_create Integer Number of created edges


d

edges_delete Int Number of deleted edges


d

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 367
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

labels_set Integer Number of labels that have been set

properties_se Integer Number of properties that have been set


t

vertices_creat Integer Number of created vertices


ed

vertices_delet Integer Number of deleted vertices


ed

Example Response
Status code: 200
Example response for a successful request (synchronous call)
Http Status Code: 200
{
"results": [
{
"columns": ["n"],
"data": [
{
"row": [
{
"occupation": "artist",
"gender": "F",
"Zip-code": "98133",
"userid": 0,
"age": "25-34"
}
],
"meta": [
{
"id": "46",
"type": "node",
"labels": [
"user"
]
}
]
}
],
"stats": {
"contains_updates": false,
"edges_created": 0,
"edges_deleted": 0,
"labels_set": 0,
"properties_set": 0,
"vertices_created": 0,
"vertices_deleted": 0
}

}
],
"errors": []
}

Status code: 200


Example response for a successful request (asynchronous call)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 368
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 200


{
"results": [
{
"columns": [
"jobId",
"jobType"
],
"jobId": "b64a5846-e306-4f87-b0f1-d595ee2a9910",
"jobType": 1,
"data": [
{
"row": [
"b64a5846-e306-4f87-b0f1-d595ee2a9910",
1
],
"meta": [
null,
null
]
}
]
}
],
"errors": []
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"results": [],
"errors": [
{
"code": "GES.8904",
"message": "Label index in vertices is not found."
}
]
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 369
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.14.2 Cypher Prerequisites


The current Cypher query compilation process uses the label-based vertex and
edge indexes. To use Cypher normally, use the index creation API to create
indexes.

● Example command for adding a vertex label index. The index name is
cypher_vertex_index, and the index type is global vertex index.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
"indexName": "cypher_vertex_index",
"indexType": "GlobalCompositeVertexIndex",
"hasLabel": "true",
"indexProperty": []
}

● Example command for adding an edge label index. The index name is
cypher_edge_index, and the index type is global edge index.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
"indexName": "cypher_edge_index",
"indexType": "GlobalCompositeEdgeIndex",
"hasLabel": "true",
"indexProperty": []
}

NOTE

1. You do not need to create the indexes if the graph is of the 100-million-edge, 1-billion-
edge, or 10-billion-edge types. (The GES version must be 2.3.6 or later.)
2. If you need to create indexes, you must create both two indexes (vertex label index and
edge label index) at the same time to use Cypher for query.
3. If your graph already has a vertex index or an edge index whose hasLabel is true and
indexProperty is empty, you do not need to create the vertex index or edge index again.
4. The API for creating an index is asynchronous. To check whether the index is successfully
created, use the API for querying job status.
5. If fine-grained permissions are used, a member account must have the schema
permission and the read permission on all labels (including the default label
__DEFAULT__) to create indexes. Otherwise, after an index is created, you need to use
an account with the required permissions to send call db.schema() to update the
compiler cache of Cypher queries.

5.1.14.3 Basic Operations and Compatibility

Basic Operations
Operation Cypher Statement

Querying vertices match (n) return n

Querying edges match (n)-[r]->(m) return n, r, m

Querying paths match (n:user)-[r]->(m:movie)-->(s:series) return n,r,m,s

Querying vertices match(n:user) where n.userid>=5 return n


based on filter
criteria

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 370
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Operation Cypher Statement

Grouping and match(n:movie) return n.genres, count(*)


aggregating

Deduplicating match(n:movie) return distinct n.genres

Sorting match(n:movie) return n order by n.movieid

Creating a vertex create (n:user{userid:1}) return n

Creating an edge match (n:user{userid:15}),(m:movie{movieid:10}) create


(n)-[r:rate]->(m)

Deleting a vertex match (n:user{userid:1}) delete n

Modifying labels match (n:user{userid:1}) set n:movie return n

Modifying properties match (n:user{userid:1}) set n.userid=2 return n

Compatibility to Cypher
1. Cypher clauses
Cypher implements a couple of clauses. You can combine clauses to
implement different query semantics, including vertex and edge filtering,
multi-hop query, sorting and deduplication, and grouping and aggregation.
Currently, GES supports the Cypher clauses listed in the following table.

Table 5-283 Supported Cypher clauses

Clause Support Example

match Partially match (n:movie) return n


supported

optional Partially optional match (n)-->(m) where id(n)='1'


match supported return m

return Supported return [1,2,3] as p

with Supported match (n) with labels(n) as label, count(*) as


count
where count > 10 return *

where Supported match (n:movie) where n.movieid > 10 return


n

order by Supported match (n:movie) return n order by n.genres

skip Supported match (n:movie) return n order by n.genres


skip 5

limit Supported match (n:movie) return n order by n.genres


skip 5 limit 10

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 371
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Clause Support Example

create Supported create (n:user{_ID_: 'Jack' }) return n

delete Supported match (n:movie)<-[r]-(m:user) delete r

set Supported match (n:user{userid:0}) set n.gender='M'


return n

call Supported call db.schema()


procedures

unwind Supported unwind [1, 2, 3] as p return p

union Supported match (n:movie) return id(n) union match


(n:user) return id(n)
NOTE
Union is available for graphs smaller than 10 billion
edges only.

NOTE

1. Currently, merge and foreach operations are not supported. Cypher statements
cannot add or delete indexes.
2. GES metadata is not schema-free, and the vertex and edge label properties are
strictly restricted. Therefore, the remove operation is not supported.
3. The order by clause does not support sorting of the list type. When Cardinality of
the property value is not single, the sorting result is unknown.
– Available items for the match clause
Item Description Example Clauses Earliest
Version
Require
d

Vertex Patterns for match 2.2.16


pattern matching vertex (n:movie{title:'hello'})
with specified match (n) where
labels, properties, id(n)='xx'
and IDs.

Edge Patterns for match (n)-[r] -> (m) 2.2.16


pattern matching match (n)-[r]- (m)
directional and
non-directional match (n)-
edges with [r:rate{Rating:1}] - (m)
specified labels match (n)-[r]- (m) where
and properties. id(n)='x'and id(m)='y'
Specified IDs of
both start and
end vertices are
supported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 372
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Path Anonymous paths match (n)-[r]->(m)-->(s) 2.2.16

Named paths match p=(n)-[r]->(m)-- 2.2.19


>(s)

Multiple You can enter multiple patterns after match 2.2.16


patterns and separate them with commas (,).
match (n)-[r]->(m), (m)-->(s)

Multi- You can enter multiple match clauses. You can 2.2.16
match use with to connect multiple clauses.
match (n)-[r]->(m) with m match (m)-->(s)

Variable- Patterns for matching variable-length paths 2.2.19


length starting with a specified vertex.
path match p=(n)-[r*1..3]->(m) where
pattern id(n)='xx'return p
match p=(n{title:'name'})-[r*1..3]->(m) return
p

Traversal conditions for matching variable- 2.2.28


length paths.
match p=(n)-[r*1..3]->(m) where id(n)='xx'and
all (x in nodes(p) where x.prop='value1') return
p

Both start vertex and end vertex of a variable- 2.3.9


length path can be specified.
match p=(n)-[r*1..3]->(m) where id(n)='xx'
and id(m)='y' return p

Deduplication by end vertex is not supported: None


match p=(n)-[r*1..3]->(m) where id(n)='xx'
and id(m)='yy'return distinct m

2. Parameterized queries
Cypher supports parameterized queries. Numeric and string values in a query
statement are extracted and converted to parameters for faster compilation,
improving the query speed.
There are some examples of parameterized queries:
– Example 1
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?
action_id=execute-cypher-query
{
"statements": [{
"statement": " match (n:user) where n.occupation = $occupation return n",
"parameters": {
"occupation" : "artist"
},
"resultDataContents": ["row"]
}]
}

– Example 2

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 373
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?
action_id=execute-cypher-query
{
"statements": [{
"statement": " match (n:user {`Zip-code`:'98133'}) set n = $props return n",
"parameters": {
"props": {
"gender": "M",
"age": "56+"
}
},
"resultDataContents": ["row"]
}]
}

NOTE

There are some scenarios where parameterized queries are not supported. The
following syntax is not valid:
1. Using $param to search by property key and value. For example, match (n) where
n.$param = 'something'
2. Using $code for vertex and edge labels. For example, match (n:user) set n:$code
3. Supported data types
Currently, GES supports 10 data types: char, char_array, float, double, Boolean,
long, Integer, date, enum, and string. Both Boolean and numeric types are
supported in the Cypher syntax. The following table lists the mapping
between other types and Cypher data types.

Table 5-284 Mapping between data types of GES and Cypher


GES Cypher Description

char String -

char_arra String -
y

string String -

enum String The Cypher syntax does not provide enum-


related syntax. During Cypher query, an enum
is converted to a string. When Cypher is used
to set properties, values that are not in the
enumeration list fail to be set.

date Temporal Currently, Cypher dates can be converted into


GES dates, but Cypher date functions cannot
be used for inputting a date.

Table 5-285 Special types supported by Cypher


Type Supported Example

Node Yes match (n) return n limit 10

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 374
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Type Supported Example

Relations Yes match (n)-[r]->(m) return r limit 10


hip

List Yes return [1,2,3] as li

Map Yes match (n)-->(m) return {start:id(n), end:id(m)}

Path Yes match p=(n1)-[:friends*1..2]-(n2) return p limit


10

Point, No -
Spatial

NOTE

For the special types listed above, only the List type can be used to match multi-value
properties in GES. Other types cannot be used in a set statement for setting the value
of a property.
4. Vertex ID compatibility
– Cypher does not provide the syntax for setting the ID when a vertex is
added. In GES, however, an ID of the string type is required to uniquely
identify a vertex. To use the Cypher syntax in GES, add _ID_ to specify the
ID of a vertex in the create statement. For example, the
create(n{_ID_:'123456'}) statement creates a vertex whose ID is 123456.
– If the ID is not specified, a random ID is generated for the vertex.
NOTE

The _ID_ identifier is supported only in the create statement. The match and set
clauses do not support the _ID_ identifier. In the match clause, you can use the
id() function to obtain the vertex ID.

5.1.14.4 Supported Expressions, Functions, and Procedures

Expression
Cypher queries support multiple expressions and can be used in combination to
form various filter criteria. Currently, the following expressions are supported.

Operation Type Expression Example

Logical and match (n:user) where n.age='Under 18' and


operations n.gender='F' return n

or match(n:user) where n.`Zip-code`='22181' or


n.userid=6 return n

not match(n:movie) where not n.genres contains


'Drama' return n

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 375
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Operation Type Expression Example

Null value is null match (n) where n.userid is null return n


judgment
is not null match (n) where n.userid is not null return n

Comparison >,>=,<,<=,=, match(n:user) where n.userid>=5 return n


calculation <>

Arithmetic +,-,*,/,%,^ return (1+3)%3


operators
(2.3.10)

String starts with match(n:movie) where n.genres starts with


comparisons 'Comedy' return n

ends with match(n:movie) where n.genres ends with


'Drama' return n

contains match(n:movie) where n.genres contains


'Drama' return n

List-related in match(n:student) where 'math' in n.courses


operation return n

[] match(n:user) return n[' userid']


with [1, 2, 3, 4] as list return list[0]
with [1, 2, 3, 4] as list return list[0..1]
match p=(n)-->(m) return [x in nodes(p)
where x.gender='F'|id(x)]

Date expressions .year, .mont Year, month, and day of a specific date: with
(2.3.10) h, .day, .hou '2000-12-27 23:44:41' as strVal with
r, .minute, .s datetime(strVal) as d2 return d2.year,
econd, .day d2.month, d2.day, d2.hour, d2.minute,
OfWeek d2.second,d2.dayOfWeek, d2.ordinalDay

NOTE

The where clause in Cypher queries does not support regular expressions.

Function
Cypher supports the following functions for grouping, aggregation, and vertex and
edge operations:
1. Aggregate
Aggregate functions count and collect are supported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 376
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supported

count 2.2.17 Returns the match (n) return count(*)


total number match (n) return
of results. count(n.userid)

collect 2.2.17 Collects match (n:movie) return


results into a n.genres, collect(n) as
list. movieList

sum 2.3.3 Returns the unwind [1, 2.0, 3] as p


sum of values. return sum(p)

avg 2.3.3 Returns the unwind [1, 2.0, 3] as p


average of return avg(p)
values.

min 2.3.3 Returns the unwind [1, 2.0, 3] as p


minimum return min(p)
value.

max 2.3.3 Returns the unwind [1, 2.0, 3] as p


maximum return max(p)
value.

2. Regular functions
Based on the types of input parameters, regular functions are classified into
vertex and edge functions, path functions, list functions, and value functions.

Table 5-286 Vertex and edge functions

Function Earliest Description Example


Version
Supported

id 2.2.16 Obtains the ID match (n) return id(n)


of a vertex.

labels 2.2.16 Obtains labels match (n) return labels(n)


of a vertex.

type 2.2.16 Obtains the match(n)-[r]->(m) return


label of an type(r)
edge.

degree 2.2.26 Obtains the match (n) where id='Vivian'


degree of a return degree(n)
vertex.

inDegree 2.2.26 Obtains the match (n) where id='Vivian'


indegree of a return inDegree(n)
vertex.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 377
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supported

outDegree 2.2.26 Obtains the match (n) where id='Vivian'


outdegree of a return outDegree(n)
vertex.

startNode 2.3.10 Obtains the match (n)-[r]->(m) return


start vertex of startNode(r)
an edge.

endNode 2.3.10 Obtains the end match (n)-[r]->(m) return


vertex of an endNode(r)
edge.

Table 5-287 Path functions


Function Earliest Description Example
Version
Supported

nodes 2.2.19 Obtains the list match p=(n)-[:friends*1..2]-


of vertices on >(m) return nodes(p)
a path.

relationshi 2.2.19 Obtains the list match p=(n)-[:friends*1..2]-


ps of edges on a >(m) return relationships(p)
path.

length 2.2.19 Obtains the match p=(n)-[:friends*1..2]-


path length. >(m) return length(p)

Table 5-288 List functions


Function Earliest Description Example
Version
Supported

head 2.3.10 Obtains the with [1,2,3,4] as list return


first element of head(list)
a list.

last 2.3.10 Obtains the with [1,2,3,4] as list return


last element of last(list)
a list.

size 2.3.10 Obtains the list with [1,2,3,4] as list return


length. size(list)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 378
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supported

range 2.3.10 Generates a return range(1,5),


list. range(1,5,2)

Table 5-289 Value functions

Function Earliest Description Example


Version
Supported

toString 2.2.21 Converts a match (n) where


value to a toString(labels(n)) contains
string. 'movi' return n

toUpper 2.2.26 Converts a match (n:movie) return


string into toUpper(n.title)
uppercase
letters.

toLower 2.2.26 Converts a match (n:movie) return


string into toLower(n.title)
lowercase
letters.

toInteger 2.2.29 Converts a with '123' as p return


string to an int toInteger(p)
number.

toLong 2.2.29 Converts a with '123' as p return


string to a toLong(p)
long number.

toFloat 2.2.29 Converts a with '123.4' as p return


string to a toFloat(p)
float number.

toDouble 2.2.29 Converts a with '123.4' as p return


string to a toDouble(p)
double
number.

toBoolean 2.2.29 Converts a with 'true' as p return


string to a toBoolean(p)
bool value.

size 2.2.29 Obtains the with 'GES' as p return size(p)


string length.

subString 2.3.10 Truncates a return subString('abc', 1),


part of a subString('abcde', 1,2)
string.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 379
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

coalesce 2.3.10 Obtains the return coalesce(null, '123')


first non-null
value of the
parameters.

trim 2.3.11 Removes return trim(' hello ')


whitespace
characters on
both sides of a
string.

lTrim 2.3.11 Removes return lTrim(' hello')


whitespace
characters on
the left side of
a string.

rTrim 2.3.11 Removes return rTrim('hello ')


whitespace
characters on
the right side
of a string.

reverse 2.3.11 Returns a return reverse('hello')


string with the
characters in
reverse order.

left 2.3.11 Obtains several with 'hello' as p return left(p,


characters 3)
from the left
side of a
string.

right 2.3.11 Obtains several with 'hello' as p return right(p,


characters 3)
from the right
side of a
string.

replace 2.3.11 Replaces a with 'hello' as p return


string. replace(p, 'll', 'o')

split 2.3.11 Splits a string. with 'hello' as p return split(p,


'e')

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 380
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-290 Mathematical functions


Function Earliest Description Example
Version
Supported

floor 2.3.10 Rounds a return floor(4.1)


number down
to the nearest
integer.

ceil 2.3.10 Rounds a return ceil(4.1)


number up to
the nearest
integer.

round 2.3.14 Round return round(3.4), round(3.5)

abs 2.3.14 Absolute value return abs(-3),abs(-3.5)


function

sin 2.3.14 Sine function return sin(pi()/2)

cos 2.3.14 Cosine return cos(0),cos(pi()/2)


function

tan 2.3.14 Tangent return tan(pi()/4)


function

acos 2.3.14 Inverse cosine return acos(1)


function

asin 2.3.14 Inverse sine return asin(0)


function

atan 2.3.14 Inverse return atan(1)


tangent
function

cot 2.3.14 Cotangent return cot(pi()/4)


function

radians 2.3.14 Converts return radians(180)


degree to
radian.

degrees 2.3.14 Converts return degrees(pi())


radian to
degree.

pi 2.3.14 Returns the return pi()


approximate
value of Pi (π).

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 381
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-291 Date and time functions


Function Earliest Description Example
Version
Supported

datetime(v 2.3.10 Returns the return datetime(1688696395)


al) time based on
the timestamp.

datetime() 2.3.14 Obtains the return datetime()


current time
(valid only for
read
statements).

timestamp( 2.3.10 Returns the return


val) timestamp timestamp('2023-07-07
based on the 02:20:42')
time string.

timestamp( 2.3.14 Obtains the return timestamp()


) current
timestamp
(valid only for
read
statements).

localDateti 2.3.14 Converts a return


me time or localDatetime(timestamp())
timestamp to a
local time
string.

Table 5-292 Predicate functions


Function Earliest Description Example
Version
Supported

all 2.2.19 If all elements all (x in p where x>1)


meet the
expression,
true is
returned.

any 2.2.19 If any element any (x in p where x>1)


meets the
expression,
true is
returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 382
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supported

none 2.2.19 If all elements none (x in p where x>1)


cannot meet
the expression,
true is
returned.

single 2.2.19 If only one single (x in p where x>1)


element meets
the expression,
true is
returned.

Table 5-293 Algorithm expressions


Function Earliest Description Example
Version
Supported

shortestPat 2.3.2 Returns the The following statement


h shortest path returns the shortest path
between two between the given vertices n
vertices. and m. The direction is m to
n, and the edge label is rate:
with n,m, shortestPath((n)<-
[:rate*]-(m)) as p return p

allShortest 2.3.2 Returns all The following statement


Paths shortest paths returns all shortest paths
between two between the given vertices n
vertices. and m:
with n,m,
allShortestPaths((n)-[*]-(m))
as p return p

NOTE

Degree functions, path operation functions, and algorithm expressions are not available if
the graph size is ten-billion-edge.

Procedure
Currently, GES supports the following procedures.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 383
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Procedure Statement

Obtaining graph pattern call db.schema()


information

Obtaining vertex labels call db.labels()

Obtaining edge labels call db.relationshipTypes()

Querying the Cypher statements call dbms.listQueries()


that are being executed

Terminating a Cypher statement call dbms.killQuery('queryId')


based on queryId

Querying indexes call db.indexes()

Full-text indexing for querying call db.index.fulltext.queryNodes()


vertices that meet the search
conditions

Full-text indexing for querying call db.index.fulltext.queryRelationships()


edges that meet the conditions

NOTE

● Full-text indexes support six types of queries: prefix, wildcard, regexp, fuzzy, match, and
combine. To use full-text indexes, you need to call the API for creating a full-text index.
● Function and procedure names are case sensitive and must be in lower camel case.
● Example of a full-text index query request
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
cypher-query
{
"statements": [
{
"statement": "call db.index.fulltext.queryNodes('combine', {title:'1977'}) yield node, score
return node, score skip 1 limit 10",
"resultDataContents": [
"row"
],
"parameters": {}
}
]
}

● Parallel edge processing policy


When using Cypher to add edges, you can add duplicate edges. Duplicate
edges are two edges with the same source vertex and target vertex.
● How to add an edge without a label
When you use a Cypher statement to add an edge, set the label of the edge
to the default value __DEFAULT__. For example, create ()-[r:__DEFAULT__]-
>() return r.

Querying the Schema Structure Using Cypher


● Function

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 384
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

You can call the db.schema () function using Cypher to query the structure of
a generated schema (obtained from OBS).
● Query statement
– Name: Schema structure query
– Statement: call db.schema()
– Note:
If you did not call the API for generating the schema structure, the
returned schema file contains all labels.
If you have called the API for generating the schema structure, this API
returns the labels as the vertices and the relationships between the labels
as edges.

5.1.15 Filtered-query API


Function
This API filters the k-hop process layer by layer, and lists the k hop vertices or
edges that meet the filtering criteria.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=filtered-query

Table 5-294 URI parameters


Parameter Mandator Type Description
y

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_nam Yes String Graph name


e

Request Parameters
NOTE

If executionMode is sync, the number of returned vertices cannot exceed 100,000.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 385
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-295 Request body parameters


Paramete Manda Type Description
r tory

execution No String ● sync: synchronous


Mode ● async: asynchronous
The default value is sync, indicating
synchronous response.

vertices Yes Array of List of IDs of source vertices to be queried


Json

query_typ No String Possible values are Default, AllVertices,


e SimpleEdges, Path.
● Default indicates the default mode, that
is, the k hop is returned.
● AllVertices returns details about all
vertices within k hops.
● SimpleEdges returns all edges within k
hops, contain only the ID and label
information of the edges.
● Path returns the path information, that is,
the set of paths.

by No Array of Specified output field. This parameter is valid


Json only when query_type is set to Default or
AllVertices. Currently, only one layer is
supported. If no field is specified, all content
is output by default.

edges No Array of List of edges to be queried. Either this


Json parameter or vertices is selected. For details,
see Table 5-296.

filters Yes Array of Filter criteria. Each element in the array


Json corresponds to a filter. For details about the
formats, see Table 5-297.

full_path No Boolean Whether to return a complete path. The


default value is false.
● If the value is true, the paths from the
source vertex to all leaf vertices are
returned.
● If the value is false, the paths from the
source vertex to the leaf vertices at layer k
are returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 386
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Manda Type Description


r tory

visualized No Boolean Whether to enable visualization. The default


value is false. In asynchronous mode:
● When visualized is false, the job query
result is returned on multiple pages.
● When visualized is true, the job query
result is returned on one page.

restricted( No Boolean Whether to verify the input. The default


2.2.28) value is true.
● true: If vertices contains vertices that do
not exist, the query exits and an error is
reported.
● false: The system filters out vertices that
do not exist and then performs the query
task.

Table 5-296 edges element formats


Paramete Manda Type Description
r tory

source Yes String Source vertex ID

target Yes String Target vertex ID

index No String Indexes of edges in the source edge set

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 387
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-297 Filters element formats


Paramete Manda Type Description
r tory

operator Yes String Query type. Possible values:


● inV: incoming vertex
● outV: outgoing vertex
● bothV: incoming and outgoing vertices
● vertex: all vertices. Filtering is available
only at the first layer. If vertices are input
in the beginning, the first-layer output is
the input vertices. If no vertices are input
in the beginning, all vertices are output at
the first layer.
● in: incoming edge
● out: outgoing edge
● both: incoming and outgoing edges
● edge: all edges. Filtering is available only
at the first layer. The usage is similar to
that of vertices
The query result of the previous layer is the
input of the next layer.
● If the result of the previous layer is a
vertex, the corresponding operations can
be inV, outV, bothV, in, out, and both.
● If the result of the previous layer is an
edge, the corresponding operation can be
inV, outV, and bothV.

vertex_filt No String This parameter is optional when operator is


er set to inV, outV, or bothV. For details about
the formats, see Table 5-299.

edge_filte No String This parameter is optional when operator is


r set to in, out, or both. For details about the
formats, see Table 5-299.

Table 5-298 by element formats


Parameter Mandat Type Description
ory

id No Boolean Whether to output the ID. The default


value is false.

label No Boolean Whether to output the label. The


default value is false.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 388
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

properties No Boolean Whether to output properties. The


default value is false.

selectedProper No Array of When properties is set to true, you


ties String can select the properties to be output.
If this parameter is left blank, all
properties are output. By default, this
parameter is left blank.

Table 5-299 property_filter element formats


Paramete Manda Type Description
r tory

leftvalue Yes String Left value. For details about the formats, see
Table 5-300.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 389
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Manda Type Description


r tory

predicate Yes String Filtering type. The supported operations


include:
Relational operators:
● =: equal to
● !=: not equal to
● <: less than
● ≤: Less than or equal to
● >: greater than
● ≥: greater than or equal to
Logical operations:
● &: and
● |: or
Set operations:
● IN/NOTIN: whether the left value and
right value have an intersection
● CONTAIN/NOTCONTAIN: whether the
property value contains the right value
● SUBSET: The right value is a subset of the
property value.
Match operators:
● PREFIX: The right value is the prefix of the
left value.
● NOTPREFIX: The right value is not the
prefix of the left value.
● SUFFIX: The right value is the suffix of the
left value.
● NOTSUFFIX: The right value is not the
suffix of the left value.
● SUBSTRING: The right value is a sub-string
of the left value.
● NOTSUBSTRING: The right value is not a
sub-string of the left value.
● FUZZY: fuzzy match
● REGEX: regex match
● CISUBSTRING: sub-string that ignores
cases
HAS/HASNOT: whether this property exists.
Only property filtering is supported. That is,
the left value can only be property_name.

rightvalue Yes String Right value. For details about the formats,
see Table 5-301.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 390
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-300 leftvalue element formats


Paramete Manda Type Description
r tory

label_nam No String If label is used as the filter criterion,


e label_name can be selected and the value is
labelName. Set the value field of rightvalue
to the label name.

property_ No String If property is used as the filter criterion,


name property_name can be selected and the value
is the property name. Set the value field of
rightvalue to the property value.

id No String If the vertex ID is filtered, this parameter is


optional.

property_f No String If predicate is set to & or |, property_filter can


ilter be nested in leftvalue and rightvalue.

Table 5-301 rightvalue element formats


Paramete Manda Type Description
r tory

value Yes String ● If label is used as the filter criterion, the


value is the label name.
● If property is used as the filter criterion,
the value is the property name.

property_f No String If predicate is set to & or |, property_filter


ilter can be nested in leftvalue and rightvalue.

Table 5-302 predicate application scenarios


predicate label_name id property_na Nested
me Filtering

& No No No Yes

| No No No Yes

HAS/HASNOT No No Yes No

CONTAIN/ No No Yes No
NOTCONTAIN

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 391
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

predicate label_name id property_na Nested


me Filtering

SUBSET No No Yes Yes (Only the


right value set
is supported.
If the right
value is
single, no
filtering
function is
available.)

IN/NOTIN Yes Yes Yes Yes (Only the


right value set
is supported.
If the right
value is
single, no
match is
available.)

PREFIX Yes Yes Yes No

FUZZY Yes Yes Yes No

REGEX Yes Yes Yes No

SUBSTRING Yes Yes Yes No

CISUBSTRING Yes Yes Yes No

=/! Yes Yes Yes No


=/</<=/>/>=

NOTE

● The left value set is supported. The left value in the body is a string.
● The right value set is supported. If you select No, only the first character string in the set
is matched even if the right value set is supported.
● Boolean value matching. When the right value is true, the value is identified as true for
matching. Otherwise, the value is identified as false for matching.

Response Parameters
● Synchronous response

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 392
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-303 Response body parameters


Paramete Type Description
r

errorMess String System prompt.


age ● 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.

data Object Query results. This parameter is left blank when


the query fails.

Table 5-304 data parameter description


Paramete Type Description
r

vertices List Vertex result set. If the last layer of filters is


vertex filtering, the data contains vertices.

edges List Edge result set. If the last layer of filters is edge
filtering, the data contains edges.

paths List Path set. This parameter is available only when


with_path is set to true. For details about the
formats, see Table 5-305.

Table 5-305 path parameter description


Paramete Type Description
r

source String Source vertex ID

target String Target vertex ID

index String Edge index

label String Edge label

● Asynchronous response

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 393
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-306 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

jobId String ID of the algorithm execution job. This parameter


is left blank when the request fails.

jobType Integer Job type. This parameter is left blank when the
request fails.

Example Request
● (Synchronous mode) List the kth-hop vertices or edges that meet filter
criteria. The execution mode is synchronous. Visualization is not performed.
That is, job query results are displayed on multiple pages.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=filtered-query
{
"executionMode": "sync",
"visualized": "false",
"filters": [
{
"operator": "outV"
},
{
"operator": "out",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "rate"
}
}
}
}
],
"full_path": false,
"vertices": [
"tr_10"
]
}

● (Asynchronous mode) List the kth-hop vertices or edges that meet filter
criteria. The execution mode is asynchronous. Visualization is not performed.
That is, job query results are displayed on multiple pages.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 394
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=filtered-query
{
"executionMode": "async",
"visualized": "false",
"filters": [
{
"operator": "outV"
},
{
"operator": "out",
"edge_filter": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "rate"
}
}
}
}
],
"full_path": false,
"vertices": [
"tr_10"
]
}

● property_filter is nested. List the kth-hop vertices or edges that meet filter
criteria. The execution mode is synchronous. Visualization is not performed.
That is, job query results are displayed on multiple pages.
{
"executionMode": "sync",
"filters": [
{
"operator": "outV",
"vertex_filter": {
"property_filter": {
"leftvalue": {
"property_filter": {
"leftvalue": {
"property_name": "genres"
},
"predicate": "PREFIX",
"rightvalue": {
"value": "A|"
}
}
},
"predicate": "&",
"rightvalue": {
"property_filter": {
"leftvalue": {
"label_name": "labelName"
},
"predicate": "=",
"rightvalue": {
"value": "movie"
}
}
}
}
}
}
],
"vertices": [
"tr_3"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 395
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

]
}

Example Response
● Synchronous response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"edges": [
{
"index": "1",
"source": "tr_1",
"label": "rate",
"properties": {
"Rating": [
0
],
"Datetime": [
""
]
},
"target": "tr_3"
},
......,
{
"index": "199998",
"source": "tr_1",
"label": "rate",
"properties": {
"Rating": [
0
],
"Datetime": [
""
]
},
"target": "tr_200000"
}
]
}
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [tesdt_117] is not found",
"errorCode": "GES.8806"
}

● Asynchronous response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "6622f13c-4b88-45f5-89a9-eaa096647c4a",
"jobType": 1
}

Status code: 400


Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 396
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "executionMode is not correct, it should be sync or async",
"errorCode": "GES.8806"
}

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.

5.1.16 Filtered-query V2

Function
This is a new version of the Filtered Query API. This API supports both Filtered
Query and Repeat Query functions.

NOTE

You can use this API to accelerate multi-hop filtered query and looped traversal query.
For example, a Gremlin query like this:
g.V('node1').repeat(out('label_2')).emit()

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=path-query

Table 5-307 URI parameters

Parameter Mandator Type Description


y

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 397
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters
NOTE

The number of elements in each traversal cannot exceed 100 million.

Table 5-308 Request body parameters


Parameter Man Type Defaul Description
dato t
ry Value

executionM No String sync Execution mode of the query task.


ode (2.2.22) The value can be sync
(synchronously) or async
(asynchronously).

vertices Yes Array of None List of IDs of source vertices you


Json want to query

repeat Yes Array of None Filter criteria for repeat queries.


Json Each element in the array
corresponds to a filter. For details
about the format, see repeat
elements.

until No Array of None Conditions to stop the traversal. The


(2.2.22) Json logic is similar to while/do loop. For
details about the format, see until
elements. For APIs of the 2.2.22
version, until supports only one
stop condition.

times No int 2 Maximum number of steps. The


default value is 2, and the
maximum value is 20.

emit No Boolean false Whether all elements will be


returned. The default value is false.
If select and as are configured, or
queryType is set to Tree, this
parameter determines whether
vertices that are not on the final
complete path will be returned.

limit No int 10000 Number of vertices, edges, or paths.

queryType(2 No String Defaul Type of the query. The value can be


.2.22) t Default or Tree. Default means
that the path query result will be
returned. Tree means that the path
information of the path query will
be returned in the tree structure.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 398
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Man Type Defaul Description


dato t
ry Value

select No Array of None Fields you want to be displayed in


(2.2.21) String the result. The values can be the
fields set in the as parameter, or
you can set the by parameter
together with this parameter to
control output content.
If you set the by parameters
together, you can set select to v0,
v1, v2, ..., and vtimes:
● v0: layer 0 of the k hops
● v1: the first layer of the K hops
● v2: the second layer of the K
hops
The path selected by this parameter
is deduplicated by default.

by(2.2.21) No Array of Output Content of output fields.


Json all 1. If this parameter is not specified,
all content is output by default.
2. If the select parameter is
configured, the number of by
must be the same as the number
of select. Each by can output
only one element.
3. If select is not configured, by
takes effect on the final result
set. For details, see by elements.

statistics No Boolean false Whether only the number of hit


records will be returned. The default
value is false.

mode No Boolean None Traversal mode that will be set


forcibly. The value can be Dense or
Sparse. The default mode is
automatically switched based on
the graph structure.

strategy No String Shorte Traversal policy. The value can be


stPath ShortestPath or Walk.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 399
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Man Type Defaul Description


dato t
ry Value

restricted No Boolean true Whether the input is restricted. The


default value is true.
● true: If vertices contains vertices
that do not exist, the query exits
and an error is reported.
● false: The system filters out
vertices that do not exist and
then performs the query task.

Table 5-309 by elements


Parameter Mandat Type Description
ory

id No Boolean Whether to output the ID. The default


value is false.

label No Boolean Whether to output the label. The


default value is false.

properties No Boolean Whether to output properties. The


default value is false.

selectedProper No Array of When properties is set to true, you


ties String can select the properties to be output.
If this parameter is left blank, all
properties are output.

Table 5-310 repeat elements


Paramete Manda Type Description
r tory

operator Yes String Type of the query. The value can be inV
(incoming vertex), outV (outgoing vertex),
and bothV (incoming and outgoing vertices).

vertex_filt No JSON Search conditions for the next hop. For


er String details about the format, see property_filter
elements.

edge_filte No JSON Edge search conditions. For details about the


r String format, see property_filter elements.

as No JSON Alias of elements at this layer. The value can


String be used to select output fields.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 400
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-311 until elements


Parameter Mandat Type Description
ory

vertex_filter No JSON This parameter is optional when


String operator in repeat is set to inV, outV,
or bothV. For details about the format,
see property_filter elements.

Table 5-312 property_filter elements


Paramete Manda Type Description
r tory

leftvalue Yes String Left value of a search condition. For details,


see leftvalue elements.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 401
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Manda Type Description


r tory

predicate Yes String Filtering type. The options are:


Relational operators:
● =: equal to
● !=: not equal to
● <: less than
● ≤: Less than or equal to
● >: greater than
● ≥: greater than or equal to
Logical operations:
● &: and
● |: or
Set operations:
● IN/NOTIN: whether the left value and
right value have an intersection
● CONTAIN/NOTCONTAIN: whether the
property value contains the right value
● SUBSET: The right value is a subset of the
property value.
Match operators:
● PREFIX: The right value is the prefix of the
left value.
● NOTPREFIX: The right value is not the
prefix of the left value.
● SUFFIX: The right value is the suffix of the
left value.
● NOTSUFFIX: The right value is not the
suffix of the left value.
● SUBSTRING: The right value is a sub-string
of the left value.
● NOTSUBSTRING: The right value is not a
sub-string of the left value.
● FUZZY: fuzzy match
● REGEX: regex match
● CISUBSTRING: sub-string that ignores
cases
HAS/HASNOT: whether this property exists.
Only property filtering is supported. That is,
the left value can only be property_name.

rightvalue Yes String Right value. For details about the format, see
rightvalue elements.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 402
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-313 leftvalue elements


Paramete Manda Type Description
r tory

label_nam No String If label is used as the filter criterion,


e label_name can be selected and the value is
labelName. Set the value field of rightvalue
to the label name.

property_ No String If property is used as the filter criterion, set


name this parameter to the property name and set
value of rightvalue to the property value.

id No String If the vertex ID is filtered, this parameter is


optional.

property_f No JSON If predicate is set to & or |, property_filter can


ilter String be nested in leftvalue and rightvalue.

degree No String Direction of vertex degree filtering statistics.


This parameter is optional. The value can be
both, in, or out.

Table 5-314 rightvalue elements


Paramete Manda Type Description
r tory

value Yes String If label is used as the search criterion, the


value is the label name. If property is used
as the search criterion, the value is the
property name.

property_f No JSON If predicate is set to & or |, property_filter


ilter String can be nested in leftvalue and rightvalue.

Table 5-315 predicate supported left values


predicate label_name id property_na Nested
me Filters

& No No No Yes

| No No No Yes

HAS/HASNOT No No Yes No

=/! Yes Yes Yes No


=/</<=/>/>=

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 403
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters
● Synchronous response

Table 5-316 Response body parameters


Paramete Type Description
r

errorMess String System prompt.


age ● 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.

data Object Query results. If the query fails, the field is


empty.

Table 5-317 data parameter description


Paramete Type Description
r

vertices List Vertex result set. If the last layer of filters is


vertex filtering, the data contains vertices.

edges List Edge result set. If the last layer of filters is


edge filtering, the data contains edges.

● Asynchronous response

Table 5-318 Response body parameters


Paramete Type Description
r

errorMess String System prompt.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 404
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Type Description


r

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.

job_id String ID of the algorithm execution job. This


parameter is left blank when the request fails.

jobType Integer Task type. This parameter is left blank when


the request fails.

Example Request
● Example request 1: List the kth-hop vertices or edges that meet filter criteria.
The query type is outgoing vertex, and the query is performed on the next-
hop vertex.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=path-query
{
"repeat":[
{
"operator":"outV",
"vertex_filter":{
"property_filter":{
"leftvalue":{
"label_name":"labelName"
},
"predicate":"=",
"rightvalue":{
"value":"rate"
}
}
}
}
],
"times":2,
"vertices":[
"1","2"
]
}

NOTE

The preceding request is equivalent to this Gremlin statement:


g.V('1','2').repeat(out().hasLabel('rate').times(2).dedup().
● Example request 2: List the kth-hop vertices or edges that meet filter criteria.
The query type is outgoing vertex, and the query is performed on the next-
hop vertex.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=path-query
{
"repeat":[
{
"operator":"outV",
"vertex_filter":{
"property_filter":{
"leftvalue":{
"label_name":"labelName"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 405
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

},
"predicate":"=",
"rightvalue":{
"value":"rate"
}
}
}
}
],
"until":[
{
"vertex_filter":{
"property_filter":{
"leftvalue":{
"property_name":"movieid"
},
"predicate":"=",
"rightvalue":{
"value":"1"
}
}
}
}
],
"vertices":[
"v1","v2"
]
}

NOTE

The preceding request is equivalent to this Gremlin statement:


g.V('v1','v2').repeat(out().hasLabel('rate')).until(has('movieid','1')).dedup()

Example Response
● Synchronous response
Status code: 200
Example response (successful request)
{
"data":{
"vertices":[
{
"id":"51",
"label":"user",
"properties":{
"occupation":[
"homemaker"
],
"gender":[
"F"
],
"Zip-code":[
"46911"
],
"userid":[
5
],
"age":[
"56+"
]
}
}
]
}
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 406
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [tesdt_117] is not found",
"errorCode": "GES.8806"
}

● Asynchronous response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "6622f13c-4b88-45f5-89a9-eaa096647c4a",
"jobType": 1
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "executionMode is not correct, it should be sync or async",
"errorCode": "GES.8806"
}

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.

5.1.17 Domain-Specific Language (DSL) Query APIs

5.1.17.1 Executing the DSL Algorithm

Function

This API is used to provide flexible and controllable DSLs to help users design and
run algorithms at low costs. For details about the DSL algorithm, see DSL Syntax.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 407
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=algorithm-
query

Table 5-319 URI parameters

Parameter Mandatory Type Description

project_id Yes String Project ID, which is used for


resource isolation. For details
about how to obtain the value,
see Obtaining a Project ID.

graph_name Yes String Graph name

Request Parameters

Table 5-320 Body parameter

Parameter Mandatory Type Description

commands Yes String Command executed by the


custom operation. For details
about the syntax, see the syntax
introduction.

Response Parameters

Table 5-321 Response 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 code


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

data Object Query results. This parameter is left


blank when the query fails.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 408
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
POST/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=algorithm-query
{
"commands":"Match<Vertex> v(['1']); v.repeat(bothV()).limit(2); return v;"
}

Example Response
● Example response for a successful request
Status code: 200
OK
{
"data":{
"vertices":[
{
"id":"1",
"label":"movie",
"properties":{
"genres":[
"Comedy"
],
"movieid":[
1
],
"title":[
"Airplane! (1980)"
]
}
}
],
"runtime":0.126476598
}
}

● Example response for a failed request


{
"errorCode":"GES.8814",
"errorMessage":"Unsupported API."
}

Return Value
● Normal
200
● Abnormal

Table 5-322 Description

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 409
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.1.17.2 DSL Syntax

Syntax Introduction
The Algorithm query API is a graph DSL provided by GES. You can use it to query
and calculate graphs. During service planning, various query operators and fine-
grained basic computing pattern operators are added to DSL so that DSL can
support user-defined graph traversal, multi-hop filtering query, pattern matching,
similarity algorithms, community algorithms, recommendation algorithms, path
analysis, and custom service algorithms.
For example, to query the neighborhood vertex set of the second hop from
vertices 1 and 2, run the following command:
Match<Vertex> v(['1','2']); v.repeat(bothV()).times(2).limit(3); return v;

DSL Statement Construction


Statements are DSL program fragments that are executed in sequence. To enrich
DSL's capability of expressing user-defined algorithms, DSL supports the following
statements: selection statement, loop statement, expression statement, operator
operand, declaration statement, and jump statement. Typically, the DSL structure
consists of a declaration statement, an expression statement, and a jump
statement. For example:
GlobalAcc<Sum,int> g=0; // Declaration statement, which declares an aggregator variable g
g+=1*3+2; // Expression statement, which is used to perform the aggregation operation on the
aggregator g. g = g + 1 x 3 + 2
return g; // Jump statement, which ends DSL and returns g

NOTE

Currently, only the following selection and loop statements are supported, which are
written in selection, loop, and lambda expressions:
1. Assignment/aggregation of various expressions
2. Update operator of the Vertex matcher
3. Gather operator of the Vertex matcher

Table 5-323 DSL syntax description

Syntax Keyword Description

Select if Executes a statement conditionally.


statement

Loop while Executes statements repeatedly.


statement

Jump return Returns different types of results.


statement

Declaration Match< ? > Declares a matcher Match to quickly


statement match graph data for more
operations.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 410
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Syntax Keyword Description

VertexAcc< ?, ?> Declares a vertex aggregator to


define additional properties/variables
on a vertex. Match can be used to
perform operations on additional
variables on vertices in batches.

GlobalAcc< ?, ?> Declares a global aggregator to


define globally operable variables.

Expression operator= Assigns values to variables.


statement
operator+= Variable aggregation operation

Arithmetic operations Arithmetic operations


+, -, *, /

Comparison operations Comparative operations


>, >=, ==, <, <=, !=

lambda expression Anonymous expressions

Operator repeat Allows users to perform multi-hop


operation filtering query. The syntax includes
statement emit, times, and limit.

update Performs a set of batch operations


defined on the matcher

gather Performs a set of batch operations


defined on the matcher

pick Quickly obtains N random vertices

init Reinitializes the vertex set of the


vertex matcher

insert Adds a matching vertex set to the


vertex matcher

move Quickly moves the vertex set in


other_match_vertex to the
match_vertex matcher

subgraph It is mainly used in the return


statement. It can return guidance
subgraphs of the match_vertex
vertex matcher.

intersection Takes the intersection of two vertex


matchers

pattern Executes a complete Cypher


statement and places the result in the
vertex matcher

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 411
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

1. Select statement: if
if(expression) {
true Branching statement
}

Executes a statement conditionally.


GlobalAcc<Sum, int> threshold = 10;
Match<Vertex> v(['1', '2']);
if(threshold < 20) {
v.repeat(outV().has('name', 'peter')).times(2).emit();
}

2. Loop statement: while


while(expression) {
true Branching statement
}

Executes some code repeatedly and conditionally


GlobalAcc<Sum, int> loop = 0;
VertexAcc<Sum, int> score = 1;
Match<Vertex> v(['1', '2']);
while(loop < 10) {
loop +=1;
v.update((v)->{v.score = 1 + 2 * v.score;});
}

3. Jump statement: return


Returns JSON files of different types and formats
Type Return Type Description

Match Vertex set -

VertexAcc map By default, values that are not


changed after initialization are not
output.

GlobalAcc Single value -

subgraph Vertex set and edge -


set

If some vertices are matched, they can be directly returned:


Match<Vertex> v(['1','2']);
return v;
{
"vertices": [
{
"id": "1",
"label": "movie",
"properties": {
"genres": [
"Comedy"
]
}
}
...
]
}

Alternatively, ACC values can be directly returned.


GlobalAcc<Max,int> g1=10;
g1+=2;

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 412
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

return g1;
{
"data": {
"value": 10
}
}

Assume that you want to obtain the guidance subgraph of a match vertex set
for subsequent task execution (for example, drawing on the canvas).
Match<Vertex> v(['1','2']);
return v.subgraph();
{
"data": {
"vertices": [
{
"id": "1",
"label": "user",
"properties": {
//balabala
}
},
{
"id": "2",
"label": "movie",
"properties": {
//balabala
}
}
],
"edges": [
{
"index": "0",
"source": "1",
"label": "rate",
"properties": {
//balabala
},
"target": "2"
}
]
}
}

4. Expression statement
An expression is a sequence of operators and operands, which specifies a
calculation. Different statements may use expressions. For example, loop
statements and selection statements may use expressions to express branches
or loop conditions. Expressions can also be used to assign values to variables
and perform aggregation operations.
– The following table lists common operators:

Common Form Symbol


Operator

Assignment a=b; =

Aggregation a+=b +=

Mathmetical a+b;a-b;a*b;a/b +, -, *, /

Comparison a>b; >, >=, ==, <, <=, !=


a=b;a<=b;a==b;a!=b

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 413
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

The calculation of aggregation operations is determined by the definition of


Aggregator.
– The following table lists the priorities among expressions:

Priori Operator Combination


ty

1 () Function call [] Left to right


Subscript .Member access a++
Suffix auto-increment a--
Suffix auto-decrement

2 a*b a/b Multiplication and Left to right


division

3 a+b a-b Addition and Left to right


subtraction

4 < <= > >= Relational Left to right


operators

5 == != Equality operators Left to right

6 and Logical AND Left to right

7 or Logical OR Left to right

8 = += Assignment, aggregation Right to left


operations

– Expression types
Due to the particularity of variables (different types of aggregators), DSL
classifies expressions into the following types:
i. numeric expression - Numerical expression
ii. vertexacc expression - Expression containing the vertexacc variable
iii. globalacc expression - Expression containing the globalacc variable
1+2*3 // Numerical expression

GlobalAcc<Sum, int> diff = 0;


VertexAcc<Sum, int> score = 0;
Match<Vertex> v(['Tom']);

1+diff*2 // Expression with globalAcc, which belongs to globalacc expression


1+v.score*2 // Expression with vertexAcc, which belongs to vertexacc expression

– Expression upgrade table


There are different constraints on assignment and calculation for
different types of expressions. That is, whether the assignment and
calculation between different types are valid is restricted.
The following expressions are used to indicate whether assignment/
aggregation operations support different expressions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 414
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Left Value/ numeric vertexacc globalacc


Right Value expression expression expression

vertexacc vertexacc Partially vertexacc


variable expression supported, the expression
same matcher
required

globalacc globalacc Not supported globalacc


variable expression expression

– Value promotion strategy


During the calculation of an expression, a right value can be converted
into a value of another type. The following lists only the supported value
promotion strategies:
i. Integer value promotion: Boolean values can be converted to integer
values. The value false changes to 0, and the value true changes to
1.
ii. Floating-point value promotion: Right values of the floating-point
type can be converted to values of the double type without changing
the values.
– Value conversion
Value conversion is currently not supported. Unlike promotion, value
conversions can change values and have potential precision losses.
– Lambda expressions
($parameters)->{statements;}

It is mainly used to receive some steps of a function. For example, both


the gather and update steps support transferring lambda expressions as
parameters. Variables such as GlobalAcc and VertexAcc are used in
lambda expressions to assign and aggregate values. Note the following:
i. The parameter type does not need to be declared and can be
identified in a unified manner.
ii. GlobalAcc in the context can be accessed by lambda expressions.
iii. Lambda expressions can be executed as independent function bodies.
The input parameters must be empty.
GlobalAcc<Sum,int> g1=0;
g1+=2*10+1;
()->{g1+=2*10+1;} // Same result as the previous statement

// update receives lambda as a parameter:


v.update((v1)->{g1+=v1.acc1*2+g2+v1.acc2;});

Variable Declaration
Match matcher
1. Match matcher description
DSL allows you to define objects such as vertices, paths, and submaps that
can be matched and on which related operations can be performed. After
declaring and initializing the matcher, you can use the matcher operator to

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 415
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

perform operations on vertex sets in batches. For details, see Match matcher
operators. Run the following statement to declare and initialize the matcher:
Match<[Vertex|Path|Subgraph]> $variable;

DSL allows you to define vertices, paths, and submaps that can be matched
and on which related operations can be performed.
Match<Vertex> Quickly match and perform operations on vertices

2. Match<Vertex> matcher: Match matcher that can be used to quickly match


and perform operations on vertex sets
Match<[ Vertex ]> $match_vertex_variable;
Match<[ Vertex ]> $match_vertex_variable($VertexList);

You can use Match<Vertex> to match or initialize vertex sets.


Match<Vertex> v(['1', '2']); // Directly match by vertex ID.
Match<Vertex> v(); // Only Match variables are defined. The vertices to be matched are empty.
Match<Vertex> v;
v.pattern('match (n:user) where n.age>30 return n limit 10'); // Uses the results of the Cypher
statements to match the filtered vertices.

DSL provides a large number of operators for Match<Vertex>, such as


pattern, init, and pick. For details, see Match matcher operators.
3. Relationship between match matcher and aggregators
You can define an aggregator to hold values and calculations. Each type of
matcher can perform operations on its corresponding aggregator in batches.
For example, you can use Match<Vertex> to perform aggregation calculation
on a specified vertex set.

Aggregator

1. Aggregator description
Aggregators are used to simplify the expression of values during calculation.
Different types of aggregators define different scopes of batch aggregation
operations.
NOTE

DSL does not support direct definition of variables of various numeric types to carry
data generated during calculation. Instead, DSL provides aggregators to simplify
operations in various application scenarios.
1. VertexAcc can be used to define additional "properties (variables)" on vertices, and
Match<Vertex> can be used to perform operations on additional variables on
vertices in batches.
2. GlobalAcc can be used to define globally operable variables.
Aggregator declaration syntax:
Accumulator<Aggregator Operator, NumericType> v;

Parameter description:
NumericType: int, (float and double types are not supported currently)
Aggregator Operator: Sum,Max,Min

DSL allows you to define different aggregators to simplify algorithm


operations. Currently, two types of aggregate variables are supported:
a. VertexAcc<Aggregator Operator, type>
b. GlobalAcc<Aggregator Operator, type>
You can perform the following operations on an aggregator:
a. Initialization: Define an aggregator and assign initial values.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 416
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

b. Assignment: Reset the aggregator values.


c. Aggregation: Perform aggregation operations based on defined
aggregator operators.
2. Aggregator operator description
Different aggregation operations are provided, such as Sum, Max, and Min.
Variables are updated using operators + and =.
$match_vertex.$vertex_accumulator += $value;
$global_accumulator += $value;
3. Vertex aggregator VertexAcc<Aggregator Operator, type>
VertexAcc can be used to quickly define additional "property (variables)" on
vertices. and Match<Vertex> can be used to perform operations on additional
variables on vertices in batches. This significantly facilitates the calculation
process.
VertexAcc<Sum, float> score = 0.5;
Each time a VertexAcc is defined, DSL allocates a variable of the type type to
each vertex in the full graph. You can use Match<Vertex> to perform
operations on the defined VertexAcc. For example:
VertexAcc<Sum, int> score = 0;
// Tom.score = 0, Jack.score = 0
Match<Vertex> v(['Tom', 'Jack']);
// Tom.score = 0, Jack.score = 0
v.score += 1; // This operation aggregates the scores of Tom and Jack. That is, their scores are
increased by 1.
// Tom.score = 1, Jack.score = 1
v.score = 10; //This operation assigns values to the scores of Tom and Jack. That is, their scores are
updated to 10.
// Tom.score = 10, Jack.score = 10
v.score += 5; // This operation aggregates the scores of Tom and Jack. That is, their scores are
increased by 5.
// Tom.score = 15, Jack.score = 15
VertexAcc can be operated by expressions. Currently, numeric, GlobalAcc, and
VertexAcc expressions can be used for aggregation and assignment.
VertexAcc<Sum, int> score = 0;
VertexAcc<Sum, int> factor = 1;
GlobalAcc<Sum, int> alpha = 10;
Match<Vertex> v(['Tom']);
// Tom.score = 0.
v.score = alpha x 2 + 3; // This operation assigns a value to Tom's score.
// Tom.score = alpha x 2 + 3 = 10 x 2 + 3 = 23

v.score += v.factor*2; // This operation assigns a value to Jack's score.


// Tom.score = Tom.score + Tom.factor x 2 = 23 + 1 x 2 = 25
4. Global aggregator GlobalAcc<Aggregator Operator, type>
Each time a GlobalAcc is defined, DSL creates a variable of the type type in
the DSL scope. Then, perform operations on GlobalAcc directly. For example:
GlobalAcc<Sum, int> diff = 0;// Define a GlobalAcc.
diff += 1;// Perform an aggregation operation, that is, diff = Sum (0,1)
// diff = 1
diff = 2 x 3;// Assign a value, that is, diff = 2 x 3
// diff = 6
GlobalAcc<Sum, int> g2 = 6;// Define a GlobalAcc.
diff += g2;// Perform an aggregation operation, that is, diff = Sum(6,g2)
// diff = 12
GlobalAcc can be operated by expressions. Currently, numeric and GlobalAcc
expressions can be used for aggregation and assignment.
GlobalAcc<Sum, int> alpha = 0;
GlobalAcc<Sum, int> beta= 10;

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 417
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

alpha = beta*2+3;
// alpha = beta x 2 + 3 = 10 x 2 + 3 = 23

Operator Introduction
Match matcher operators
After a Match matcher is defined, different operation operators, such as repeat,
gather, update, and pattern, can be used to assist graph calculation and query.
The operation operator varies with the match type.

Operator Description Matcher Anonymous Select/Loop


Expression Statement

repeat Performs Vertex × ×


multi-hop
filtering like
Gremlin.

pick Randomly Vertex × ×


selects
vertices.

pattern(2.3.11 Runs Cypher Vertex × ×


) statements.

update Performs a Vertex √ √


set of batch
operations
defined on
the matcher.

gather Performs a Vertex √ √


set of batch
operations
defined on
the matcher.

init(2.3.12) Initializes the Vertex × ×


matching
vertex set
based on a
specified ID.

insert(2.3.12) Add new Vertex × ×


vertices to the
matcher.

move(2.3.12) Quickly Vertex × ×


moves other
matcher
vertex sets.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 418
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Operator Description Matcher Anonymous Select/Loop


Expression Statement

intersection(2. Calculates the Vertex × ×


3.12) intersection of
vertices.

subgraph(2.3. Obtains Vertex × ×


12) guidance
subgraphs.

● repeat
It allows you to perform multi-hop filtering query. The syntax of repeat is
similar to that of repeat in Gremlin. Its semantic expression ability is rich,
especially suitable for relational link query.
For example, if a two-hop query of filtering name=peter is executed from
vertex (1,2) to the outgoing direction, it may be expressed in Gremlin as:
g.V('1','2').repeat(out().has('name','peter')).times(2).emit().dedup()

In DSL, the preceding functions can be written as follows:


Match<Vertex> v(['1','2']);
v.repeat(outV().has('name','peter')).times(2).emit();

– The repeat step contains some unique associated steps:


Parameter Mandatory Type Defaul Description
t
Value

repeat Yes traversal None Executes the repeat


step rule.

times No int 2 Maximum number


of steps. The
default value is 2,
and the maximum
value is 20.

emit No bool false Whether all


elements will be
returned. The
default value is
false. If select-as
or path is set for
output, this
parameter
determines whether
vertices that are not
on the final
complete path will
be returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 419
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Defaul Description


t
Value

limit No int 10000 Number of vertices,


edges, or paths.

– Rules in repeat consist of traversal and filter criteria. They can be


multiple rules separated by commas (,).

Table 5-324 Traversal process description

Step Description

outV Neighbor vertex in the outgoing direction

inV Neighbor vertex in the ingoing direction

bothV Neighbor vertex in both directions

outE Edge in the outgoing direction

inE Edge in the ingoing direction

bothE Edge in both directions

otherV Neighborhood vertex

Table 5-325 Filter criteria description

Filter Criterion Description

has(key) Whether the property name key exists

has(key, value) Whether the value of the property name key is


value

hasLabel(values) Whether the label value is one of values


(V2.3.5)

and(filter operator Logical operator of filter criteria. Criteria A and B


A, filter operator B) must be both met. They can be nested.

or(filter operator A, Logical operator of filter criteria. Either criterion


filter operator B) A or B needs to be met. They can be nested.

and(has('person'), or(has('name', 'peter'), has('age', '30')))

has('person') // The property name person exists.


has('name', 'peter') // The value of the property name name is peter.
hasLabel('movie','user') // The label value is movie or user.
and( has('name', 'peter'), has('age', '30')) // The property name is peter and age is 30.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 420
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

● update
$match_vertex.update($lambda_func);
The update operator is used to define a group of batch operations on the
matcher. Currently, only Match<Vertex> is supported.
The Update operation on Match<Vertex> applies all operations defined in the
input lambda function to the vertices matched by Match.
The vertex matcher Match<Vertex> receives only lambda expressions that
contain one input parameter.
Match<Vertex> v(['1',2']);
VertexAcc<Max,int> acc=1;
GlobalAcc<Sum,int> g=0;
v.update( (v1)->{g+=v1.acc*2;} ); //g='1'.acc*2+'2'.acc*2=1*2+1*2=4
return g; // Return g = 4;
● gather
$match_vertex.gather($lambda_func);
The gather operator is used to define a group of batch operations on the
matcher. Currently, only Match<Vertex> is supported.
– gather of Match<Vertex>
The Gather operation on Match<Vertex> applies all operations defined in
the input lambda function to the edges of the vertices matched by
Match.
The vertex matcher Match receives only lambda expressions that contain
two input parameters. The first parameter indicates the source vertex on
the edge, and the second parameter indicates the target vertex on the
edge.
Match<Vertex> v(['1',2']);
VertexAcc<Max,int> acc=1;
GlobalAcc<Sum,int> g=0;
v.gather( (s,t)->{g+=s.acc*2+t.acc;} ); // This operation takes effect on the edges of vertices 1
and 2. That is, 1-2, 1-3, 2-3, 2-1.
//g=g + 1.acc*2+2.acc + 1.acc*2+3.acc + 2.acc*2+1.acc + 2.acc*2+3.acc
//g=0 + 3 + 3 + 3 + 3=12
return g;
● pick
$match_vertex.pick(n);
pick allows you to randomly select N vertices from Match<Vertex>. This
function helps you quickly obtain N random vertices.
Match<Vertex> v();
v.pick(10); // Select 10 vertices randomly from v.
return v; // Return information about 10 random vertices.
● init(2.3.12)
$match_vertex.init([vertex_list]); // Specify the vertex ID list.
$match_vertex.init(vertexid); // Specify a single ID.
Resets the vertex set of the vertex matcher.
Match<Vertex> v(['1','2']);
return v;// Return information about vertices 1 and 2.
Match<Vertex> v(['1','2']);
v.init(['3','4']);
return v;// Return information about vertices 3 and 4.
● insert(2.3.12)
$match_vertex.insert([vertex_list]); // Specify a list of vertex IDs.
$match_vertex.insert(vertexid); // Specify a single ID.
Adds a matching vertex set to the vertex matcher.
Match<Vertex> v(['1','2']);
return v;// Return information about vertices 1 and 2.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 421
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Match<Vertex> v(['1','2']);
v.insert(['3','4']);
return v;// Return information about vertices 1, 2, 3, and 4.
● move(2.3.12)
$match_vertex.move(other_match_vertex);
Quickly moves the vertex set in other_match_vertex to the match_vertex
matcher This operator can assign a value to another matcher by one matcher,
but does not produce a replication result. Instead, it is similar to the move
semantics in C++, that is, moving the original matcher vertex set to the new
matcher. After the operation, the original matcher vertex set is cleared.
Match<Vertex> v1(['1','2']);
Match<Vertex> v2(['3','4']);
v1.move(v2);//v1=[3,4],v2=[]
return v1;// Return information about vertices 3 and 4.
● subgraph(2.3.12)
$match_vertex.subgraph();// Return guidance subgraphs of the matcher vertex set.
$match_vertex.subgraph(filter_step);// Return guidance subgraphs of the matcher vertex set with
edge filtering.
It is mainly used in the return statement. It can return the induced subgraph
of the match_vertex vertex matcher.
When obtaining a subgraph, you can set the filter criterion filter_step on the
edge. For details about the syntax, see the filter operator in repeat.
Match<Vertex> v(['1','2']);
return v.subgraph();// Return vertices 1 and 2 as well as the edge set between vertices 1 and 2.

Match<Vertex> v(['1','2','3']);
return v.subgraph(has(year, 2022));// Return vertices 1 and 2 as well as the edge set between vertices
1 and 2.
● Set basic operations (2.3.12)
Set operations can be performed on objects in each matcher, such as union
and intersection.
intersection (2.3.12)
Match<Vertex> start(['1','2']);
Match<Vertex> target(['2']);
Match<Vertex> set;
start.intersection(target);
return start;// Return vertex 2.
● Pattern Matching: pattern (2.3.11)
DSL uses the Cypher syntax to express pattern matching, such as vertex set,
path, and subgraph matching.
Statements that support Cypher:
Statement Supported or Not

match(2.3.11) Partially supported

limit(2.3.11) Supported

return(2.3.11) Supported

DSL uses the step-pattern of the Match variable to implement pattern


matching.
For example, you need to use a certain rule to match vertices.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 422
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Match<Vertex> v;
v.pattern('match (n:user) where n.age>30 return n limit 10');
The pattern is a complete Cypher statement, which filters 10 vertices and
returns them to Match<Vertex>.
String in Cypher
The pattern syntax contains a complete Cypher statement in single quotation
marks. When a string to be expressed, such as an ID or property value,
appears in the Cypher statement, double quotation marks are required.
When using REST APIs to call DSL, you need to add the escape character \ to
the double quotation marks. For example:
Match<Vertex> v;
v.pattern('match (n) where id(n)=\"12\" return n');
return v;

5.1.18 Updating Specified Properties of Vertices and Edges by


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

NOTE

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 5-326 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

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 data set format is CSV. The
edge file directory is datasets/movie/ranking_edge.csv, and the edge data set
format is CSV.
POST http://Endpoint/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-properties
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 423
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"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
}

Request Parameters
NOTE

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 5-327 Request body parameters

Parameter Mandatory Type Description

vertexsetPath Either String Vertex file directory or name


vertexsetPath
or
edgesetPath
is mandatory.

vertexsetFormat No String Format of the vertex data set.


Currently, only the CSV format is
supported.
The CSV format is used by default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 424
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

vertexProperties Mandatory if Objec Label of a vertex and list of


vertexsetPath t properties to be updated in a vertex
exists file, in JSONArray format

edgesetPath Either String Edge file directory or name


vertexsetPath
or
edgesetPath
is mandatory.

edgesetFormat No String Format of the edge data set.


Currently, only the CSV format is
supported.
The CSV format is used by default.

edgeProperties Mandatory if Objec Label of an edge and list of


edgesetPath t properties to be updated in an edge
exists file, in JSONArray format

targetProperties Mandatory if Objec Indicates property information used


edgesetPath t to distinguish duplicate edges in the
exists edge file, in JSONArray format.

delimiter No Chara Field separator in a CSV file. The


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

trimQuote No Chara Field quote character in a CSV file.


cter The default value is double
quotation marks ("). It is used to
enclose a field if the field contains
separators or line breaks.

obsParameters Yes String OBS authentication parameters. For


details, see Table 5-267.

vertexFileContai No Boole Whether the vertex file contains


nLabel an label information. This parameter is
optional. The default value is true.

Table 5-328 vertexProperties parameter description


Parameter Mandatory Type Description

label Yes String Name of a label

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 425
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-329 edgeProperties parameter description

Parameter Mandatory Type Description

label Yes String Name of a label

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-330 targetProperties parameter description

Parameter Mandatory Type Description

label Yes String Name of a label

properties Yes Object Edge ID properties, in JSONArray


format. Currently, only one property is
supported.

Response Parameters

Table 5-331 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

job_id String ID of an asynchronous job


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

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 426
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response (successful request)


Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "parameter format error",
"errorCode": "GES.8013"
}

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.

5.1.19 Deleting Vertices and Edges by Reading Files

Function
This API is used to delete vertices and edges by reading the files.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=delete-by-file

Table 5-332 URI parameters

Parameter Mandat Type Description


ory

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 427
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

graph_na Yes String Graph name


me

Example Request
Delete vertices and edges by reading files. The vertex file directory is datasets/
movie/movie.csv, and the vertex data set format is CSV. The edge file directory is
datasets/movie/ranking_edge.csv, and the edge data set format is CSV.
POST http://Endpoint/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=delete-by-file
{
"vertexsetPath": "datasets/movie/movie.csv",
"vertexsetFormat": "csv",
"edgesetPath": "datasets/movie/ranking_edge.csv",
"edgesetFormat": "csv",
"targetProperties": [
{
"label": "rate",
"properties": [
"Rating"
]
}
],
"delimiter": ",",
"trimQuote": "\"",
"obsParameters": {
"accessKey": "XXXXXXX",
"secretKey": "XXXXXXX"
}
}

Request Parameters

Table 5-333 Request body parameters

Parameter Mandatory Type Description

vertexsetPath Either String Vertex file directory or name


vertexsetPath or
edgesetPath is
mandatory.

vertexsetFormat No String Format of the vertex data


set. Currently, only the CSV
format is supported.
The CSV format is used by
default.

edgesetPath Either String Edge file directory or name


vertexsetPath or
edgesetPath is
mandatory.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 428
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

edgesetFormat No String Format of the edge data set.


Currently, only the CSV
format is supported.
The CSV format is used by
default.

targetProperties No Object Indicates property


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

delimiter No Charact Field separator in a CSV file.


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

trimQuote No Charact Field quote character in a


er 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
about the parameters, see
Table 5-267.

Table 5-334 targetProperties parameter description


Paramet Mandat Type Description
er ory

label Yes String Name of a label

properti Yes Object Edge ID properties, in JSONArray format.


es Currently, only one property is supported.

NOTE

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


● Vertex file: Vertex ID
● Edge file (excluding the label): source vertex ID and destination vertex ID
● Edge file (including the label): source vertex ID, destination vertex ID, label, and edge ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 429
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-335 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.

jobId String ID of an asynchronous job


You can view the job execution status and obtain
the return result by querying the job ID. For
details, see Querying Job Status on the Service
Plane.

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "parameter format error",
"errorCode": "GES.8013"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

403 Forbidden No operation permissions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 430
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

404 Not Found No resources found.

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes.

5.1.20 Intelligent Q&A API (HDFS Scenario)


Function
Intelligent Q&A uses natural language analysis and processing capabilities of
machines to understand questions raised by users, and uses structured knowledge
in GES graphs for query and inference to find accurate answers to the questions
and provide the answers to users, helping users solve different types of problems.

NOTE

This feature can be enabled only when the deployment mode is ECS+MRS. (MRS version:
3.3.1-LTS)

URI
● URI format
POST /ges/v1.0/{project_id}/graphs/{graph_name}/conversations

● Parameters

Table 5-336 URI parameters


Parameter Mandatory Description

project_id Yes Project ID, which is used for resource


isolation. For details, see Obtaining a
Project ID.

graph_name Yes Graph name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 431
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request

Table 5-337 Request body parameters


Parameter Mandatory Type Description

query Yes String Question content of a user.


Common question types and
answers are as follows:
● Enumeration
All answer entities and entity
properties are enumerated.
The following are examples:
Q: What is the starring of film
Heroes?
A: Properties of all starring
are enumerated.
● Simple predicate
The specific entity
information is directly
returned.
The following are examples:
Q: What is the data of birth
for William?
A: William was born on
November 12, 1982.
● Complex predicate
Information about a list of
entities is directly returned.
For example,
Q: What is the date of birth
for starring in film Heroes?
A: The dates of birth of all
starring in Heroes are listed.

session_id No String KG-QA session ID If the request


does not contain this parameter,
a new session is automatically
created and the session ID is
returned.

Response
● Successful response parameters

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 432
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-338 Response Parameters

Parameter Type Description

frame JSON Array Detailed query result, which is an internal


object of the array. For details about the
parameters in the returned result, see
Description of the frame parameter.

answer String Answer text (multiple answers are


combined).

session_id String ID of the current KBQA session.

Table 5-339 frame parameter description

Parameter Type Description

formatted_questio String Resolution of the user question, that is,


n the formatted question.

match_type String Type of the matching template


corresponding to the user question. The
value is SYS_TEMPLATE (system built-in
template).

template_id String ID of the matching template


corresponding to the user question.

template_name String Name of the matching template


corresponding to the user question.

template_score Double Matching score corresponding to the


matching template.

query String Query statement used by the system to


query answers

result List Query result corresponding to the query


statement. Data structure of the result
field describes the parameters in the
returned result.

answer String Answer text corresponding to the query


statement.

Table 5-340 result data structure

Parameter Type Description

vertices List Entity query result For details about the


parameters in the returned result, see the
vertices data structure.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 433
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

edges List Relationship query result Data structure


of the edge type describes the
parameters in the returned result.

path List Path query result, which is a set of


relationships that form the path. For
details about the parameters in the
returned result, see the path data
structure.

results Dictionary Attribute query result. The key is the


attribute name, and the value is the
attribute value list.

runtime Double Command execution time. The unit is


second.

NOTE

The returned result depends on the executed Gremlin statement. Therefore, there is a
possibility that the fields in the returned result are empty.

Table 5-341 vertices data structure


Parameter Type Description

id String Entity ID

label String Entity type

properties Object Property value of an entity. The format is the


dictionary data structure. The key is the property
name and the value, a character string list, is the
property value.

Table 5-342 Path and edge data structures


Parameter Type Description

index String Index of a relationship, which identifies the


relationship sequence between the head entity
and tail entity

source String Head entity ID

target String Relationship tail entity ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 434
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

id String Relationship ID. The format is source (header


entity ID)-target (tail entity ID)-index
(relationship index), for example,
4730302-1963128-1. Indicates the first
relationship between the entity whose ID is
4730302 and the entity whose ID is 1963128.

Example
● Example Request
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/conversations
{
"query": "What is the release time of the disaster adventure?"
}

● Example Response
– Example of a successful response
{
"answer": "The disaster adventure was released on December 4, 1960.",
"frame": [
{
"formatted_question": "When is [release time] of [disaster adventure] => [disaster adventure]
[release time]",
"match_type": "SYS_TEMPLATE",
"template_id": "e35cb3a8-0c20-48f8-94d2-a2ae635412e6",
"template_name": "xx attribute of xx entity",
"template_score": 0.7400000095367432,
"query": "g.V('6078981978916491674').valueMap ('name','Release time').path()",
"result": {
"vertices": [
{
"id": "6078981978916491674",
"label": "Movie"
}
],
"runtime": 0.163641278,
"results": [
{
"name": [
"Disaster adventure"
],
"Release time": [
"4 December 1960"
]
}
]
},
"answer": "The disaster adventure was released on December 4, 1960."
}
],
"session_id": "a8dbb6ce-a9ed-4bc9-b219-caaa5bbe7b1c"
}

– Example failed response


Status code: 400
Example response for a failed request
{
"error_code": "KGP.4101",
"error_msg": "Internal error!"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 435
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.2 Database Edition

5.2.1 Specification Description


As a new graph database product, the database edition provides graph
management, graph data addition, deletion, modification, query, and analysis
capabilities, supports Cypher, and provides graph data persistence to flush data
written by users to disks. In this way, multiple copies and hardware redundancy
are used to achieve high availability and fast fault recovery. Currently, the
database edition has completed storage and query of hundreds of billions and
trillions of graphs.
The following sections describe the APIs supported by database graphs.

Data Types
Type Description

char Character

float Float type (32-bit float)

double Double type (64-bit float)

bool Boolean type. Available values are 0/1 and true/false.

long Long integer (value range: -2^63 to 2^63–1)

int Integer (value range: -2^31 to 2^31–1)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 436
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Type Description

date Date. Currently, the following formats are supported:


● YYYY-MM-DD HH:MM:SS
● YYYY-MM-DD
NOTE
The value of MM or DD must consist of two digits. If the value contains
only one digit, add 0 before it, for example, 05-01.

string Variable-length string

enum Enumeration type. The maximum number is 65535. Each


enumeration type is a string.

Data Import Restrictions


There are some restrictions when you import data to a database edition graph:
● Importing data concurrently
Multiple data files can be imported at the same time. To accelerate the
import, split a large file into multiple OBS files that each does not exceed 5
GB.
● Uploading import logs to OBS
Set the logDir parameter to save import logs where you can find the error
cause.
● Importing edge data
If you import only edges of a database edition graph, DLI cannot
automatically generate vertices for the graph. If only edges are imported, you
cannot query vertices or access the graph from vertices. You are advised to
import vertex data too.

5.2.2 Vertex Operation APIs

5.2.2.1 Querying Vertex Details

Function
This API is used to query the vertex information (such as the label and property)
based on the vertex ID.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/detail?
vertexIds={vertex_ids}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 437
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-343 URI parameters


Parameter Mandator Type Description
y

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

vertex_ids Yes String IDs of the vertices to be queried. You can


specify only one vertex ID for a database
edition graph.

Request Parameters

Table 5-344 Request body parameter


Parameter Type Description

data List Vertex details you want to query. For


details, see data parameters.

Table 5-345 data parameter description


Parameter Type Description

vertices List Vertex result set. If no corresponding


vertices are found, the value of vertices
is empty.

Response Parameters

Table 5-346 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 438
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

errorCode String System prompt.


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

data Object Query results.

Example Request
Query node information by node ID and return node details.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/detail?vertexIds=Ray

NOTE

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

Example Response
Status code: 200
Example of a successful response
Http Status Code: 200
{
"data": {
"vertices": [
{
"id": "46",
"labels": [
"user"
],
"properties": {
"user": {
"userid": [
0
],
"gender": [
"F"
],
"age": [
"25-34"
],
"occupation": [
"artist"
],
"Zip-code": [
"98133"
]
}
}
}
]
},
"result": "success"
}

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 439
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example of a failed response


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8204"
}

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.

5.2.2.2 Querying Vertices in Batches

Function
This API is used to query the vertex data (such as the labels and properties) in
batches based on the vertex IDs.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?
action_id=batch-query

Table 5-347 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 440
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-348 Request body parameter

Paramet Mandator Type Description


er y

vertices Yes String Vertex IDs you use to query the vertices

Response Parameters

Table 5-349 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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.


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

data Object The data field is contained when the query is


successful, and the data field contains the vertices
query result.

result String Query results. If the request is successful, the


value is success. If the request fails, the value is
failed.

Example Request
Query nodes in batches by node ID. The vertex IDs to be queried are
27003509_Station Building and 39636392_Badaling Great Wall.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-
query
{
"vertices":
["0","1"]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 441
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"vertices": [
{
"id": "0",
"labels": [
"movie"
],
"properties": {
"movie": {
"movieid": [
0
],
"title": [
"American Beauty (1999)"
],
"genres": [
"Comedy|Drama"
]
}
}
},
{
"id": "1",
"labels": [
"movie"
],
"properties": {
"movie": {
"movieid": [
1
],
"title": [
"Airplane! (1980)"
],
"genres": [
"Comedy"
]
}
}
}
]
},
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": " Bad Request, parameter vertices cannot be null",
"errorCode": "GES.8214"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 442
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.2.2.3 Adding Vertices in Batches

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 5-350 URI parameters


Parameter Mandato Type Description
ry

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 443
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-351 Request body parameters

Parameter Manda Type Description


tory

vertices Yes JSON Vertices you want to add. A maximum of


10,000 vertices can be added at a time. For
details about this array, see the vertices
parameters.

overrideExi No Boolea Checks whether the vertex to be inserted


sts n exists. The default value is false.
● If this parameter is set to false, an error is
reported as long as there is one vertex, and
all vertices fail to be written.
● If this parameter is set to true, the existing
vertices are overwritten.

Table 5-352 vertices parameter description

Paramete Mandat Type Description


r ory

vertex Yes String Vertex ID

label Yes String Vertex label

properties No JSON Value of each property

Response Parameters

Table 5-353 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 444
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

result String Request result. If the request is successful, the


value is success. If the request fails, the value is
failed.

Example Request
Add vertices in batches. The names of the vertices to be added 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
}

NOTE

● 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 (successful request)


Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 445
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "vertex [Lily] already exists",
"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.

5.2.2.4 Deleting Vertices in Batches

Function
This API is used to delete vertices in batches based on the vertex IDs.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?
action_id=batch-delete

Table 5-354 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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 446
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-355 Request body parameters


Param Manda Type Description
eter tory

vertices Yes String Vertex ID array to be deleted

Response Parameters

Table 5-356 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.


● 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 Request
Delete nodes in batches by node ID. The vertex IDs to be deleted are Vivian and
46.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=batch-
delete
{
"vertices": [
"Vivian",
"46"
]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 447
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": " Bad Request, parameter vertices cannot be null",
"errorCode": "GES.8214"
}

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.

5.2.2.5 Updating Vertex Properties in Batches

Function
This API is used to update vertex properties in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/properties/action?
action_id={actionId}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 448
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-357 URI parameters


Parameter Mandat Type Description
ory

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:


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

Request Parameters

Table 5-358 Request body parameters


Parameter Mandatory Type Description

vertices Yes JSON Vertex array to be updated For details


about this array, see the vertices
parameters.

ignoreErro No Boolean Whether to ignore the update error of


r specific vertices. The default value is
false.
● The value false indicates that if an
error that causes the update failure is
detected, for example, the vertex to be
updated does not exist, an error is
reported and no vertex will be
updated.
● The value true indicates that similar
errors will be ignored and other vertex
properties without errors will be
updated.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 449
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-359 vertices parameter description

Parameter Mandatory Type Description

vertex Yes String Vertex ID

label No String Vertex label

properties Yes JSON Value of each property to be updated

Response Parameters

Table 5-360 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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.


● 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 Request
Update vertex properties in batches. The vertex names to be updated are 150 and
6.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/properties/action?
action_id=batch-update
{
"vertices": [
{
"vertex": "150",
"label": "movie",
"properties": {
"movieid": [
"150"
],
"title": [
"testmoive"
],
"genres": [
"Comedy"
]

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 450
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

}
},
{
"vertex": "6",
"properties": {
"title": [
"testmoive_exist_id"
],
"genres": [
"Comedy"
]
}
}
],
"ignoreError": true

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"vertex [Lily] does not exist",
"errorCode":"GES.8220"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 451
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.3 Edge Operation APIs

5.2.3.1 Querying Edge Details

Function
This API is used to query the detailed information about an edge based on the
source vertex, target vertex, and index of the edge. Information about edges and
properties is returned.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/edges/detail?
source={sourceVertex}&target={targetVertex}&label={label}&sortKey={sortKey}&sortKeyType={sortKeyType}

Table 5-361 URI parameters


Parameter Manda Type Description
tory

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 5-362 Request body parameters


Parameter Manda Type Description
tory

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

sourceVertex Yes String Source vertex of an edge

targetVertex Yes String Target vertex of an edge

Label (for No String Label of an edge


database
edition)

sortKey (for No String Sort key value of duplicate edges.


database
edition)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 452
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Type Description


tory

sortKeyType No String Type of the sort key of duplicate edges.


(for This parameter is mandatory when
database sortKey is set to int, string, or null.
edition)

Response Parameters

Table 5-363 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.


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

data Object Query results. If the query is successful, the query


result will be returned. If the query fails, this
parameter will be left blank.

result String Query result. If the query is successful, the value is


success. If the query fails, the value is failed.

Table 5-364 data parameter

Paramete Mandato Type Description


r ry

edges Yes List Edge result set. If no edge is found, this


parameter will be left blank.

Example Request
Query details about an edge.
GET/ges/v1.0/{project_id}/graphs/{graph_name}/edges/detail?
source=46&target=39&label=rate&sortKey=5&sortKeyType=int

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 453
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

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


{
"data": {
"edges": [
{
"source": "46",
"target": "39",
"label": "rate",
"sortKey": 5,
"properties": {
"Rating": [
5
],
"Datetime": [
"2018-01-0120:30:05"
]
}
}
]
},
"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8107"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 454
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.3.2 Querying Edges in Batches

Function
This API is used to query the detailed information about edges in batches based
on the source vertices, target vertices, and indexes of the edges. Information about
edges and properties is returned.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
query

Table 5-365 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_nam Yes String Graph name


e

Request Parameters

Table 5-366 Request body parameter


Parameter Mandatory Type Description

edges Yes Object Edge array to be queried

Table 5-367 edges parameter description


Parameter Mandatory Type Description

source Yes String Source vertex of an edge

target Yes String Target vertex of an edge

label No String Edge label

sortKey No String/int/ Sort key of duplicate edges. If


null sortKey is specified during query,
label must be set too.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 455
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-368 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.


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

data String The data field is contained when the query is


successful, and the data field contains the edges
query result.

result String Query result. If the query is successful, the value


is success. If the query fails, the value is failed.

Example Request
Query details about edges in batches based on the source vertex, target vertex,
and index. The source vertex of the edges to be queried is Vivian.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
query
{
"edges": [
{
"source": "Vivian",
"target": "Lethal Weapon",
"label": "rate"
},
{
"source": "Vivian",
"target": "Raising Arizona"
}
]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 456
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"data": {
"edges": [
{
"source": "Vivian",
"target": "Raising Arizona",
"label": "rate",
"properties": {
"Score": [
4
],
"Datetime": [
"2000-12-27 23:51:42"
]
}
},
{
"source": "Vivian",
"target": "Lethal Weapon",
"label": "rate",
"properties": {
"Score": [
5
],
"Datetime": [
"2000-12-27 23:44:41"
]
}
}
]
},
"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"parameter does not contain 'source'",
"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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 457
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.3.3 Adding Edges in Batches

Function
This API is used to add edges in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
add

Table 5-369 URI parameters


Parameter Mandato Type Description
ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_nam Yes String Graph name


e

Request Parameters
Parameter Manda Type Description
tory

edges Yes Object Edge array to be added

parallelEdge No Object Repetitive edge processing

action No String Processing method. The value can be


override or ignore.
● If the value is override, the
previous repetitive edges are
overwritten.
● If the value is ignore and an edge
already exists, the previous edge
will not be overwritten. If no edge
exists, the system adds an edge.

ignoreLabel No Boolean Whether to ignore labels on repetitive


edges. The value can only be false.
false: Edges with the same source
vertex, target vertex, and label are
duplicate edges.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 458
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Type Description


tory

createNotExi No Boolean Whether to add source or target


sts vertices that do not exist in the edges
parameter before adding edges. The
value can only be false.
false: Edges can be added regardless
of whether the source or target
vertex exists.

Table 5-370 edges parameter description

Parameter Manda Type Description


tory

source Yes String Source vertex of an edge

target Yes String Target vertex of an edge

label Yes String Edge label

sortKey No String/int/null Sort key of duplicate edges.

properties No Object Value of each property

Response Parameters

Table 5-371 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.


● 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 459
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Add edges in batches. The source vertex is 46, the target vertices are 39 and 38,
and the edge label is rate.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-add
{
"edges": [
{
"source": "46",
"target": "39",
"label": "rate",
"properties": {
"Rating": [
5
],
"Datetime": [
"2018-01-0120:30:05"
]
}
},
{
"source": "46",
"target": "38",
"label": "rate",
"properties": {
"Rating": [
4
],
"Datetime": [
"2018-01-0120:30:05"
]
}
}
],
"parallelEdge": {
"action": "override",
"ignoreLabel": false
},
"createNotExists": false
}

NOTE

● SERVER_URL: Address for accessing a graph. For details about its value, see Using
Service Plane APIs.
● In the example, if vertices 666 and 777 are not in the original graph, create vertices 666
and 777, retain the default value of each label, and add an edge.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result":"success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"edge source vertex [Lily] does not exist",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 460
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"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.

5.2.3.4 Deleting Edges in Batches

Function
This API is used to delete edges in batches based on the source vertices, target
vertices, and indexes of the edges.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-
delete

Table 5-372 URI parameters


Parameter Mandato Type Description
ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 461
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-373 Request body parameters


Parameter Mandat Type Description
ory

edges Yes Object Edge array to be deleted

ignoreError No Boolean Whether to ignore errors, for example,


the edge to delete does not exist. The
default value is false, indicating that
errors will not be ignored. Errors in
JSON format cannot be ignored.

Table 5-374 edges parameter description


Parameter Mandat Type Description
ory

source Yes String Source vertex of an edge

target Yes String Target vertex of an edge

index No String Edge index

label No String Label of an edge. If the index


parameter is set, this parameter is
ignored. If the index parameter is not
set, an edge that meets the source,
target, and label conditions is deleted.
If the specified label value does not
exist in the schema or the edge with
the same label does not exist, no edge
will be deleted.

sortKey No String/I Sort key of duplicate edges. If sortKey


nt/Null is specified during query, label must be
set too.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 462
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-375 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.


● 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 Request
Delete edges in batches. The source vertices of the edges are
39631050_Landscape and 27803870_Landmark building, and the target vertices
of the edges are 27803870_Landmark building and 27661363_Villa hot spring.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-delete
{
"edges": [
{
"source": "39631050_Landscape",
"target": "27803870_ Landmark building"
},
{
"index": "0",
"source": "27803870_Landmark building",
"target": "27661363_Villa hot spring"
}
],
"ignoreError": true
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 463
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"result": "success"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"parameter does not contain 'source'",
"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.

5.2.3.5 Updating Edge Properties in Batches

Function
This API is used to update edge properties in batches.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?
action_id={actionId}

Table 5-376 URI parameters

Parameter Mandato Type Description


ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 464
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandato Type Description


ry

actionId Yes String Operator. Possible values:


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

Request Parameters

Table 5-377 Request body parameters

Paramete Manda Type Description


r tory

edges Yes JSON Edge array to be updated

ignoreErro No Boolean Whether to ignore the update error of


r specific edges. The default value is false.
● If the value is false, an error that causes
the update failure is detected. For
example, if the edge to be updated does
not exist, an error is reported and no
edge is updated.
● If the value is true, similar errors are
ignored and other edge properties
without errors are updated.

Table 5-378 edges parameter description

Paramete Mandat Type Description


r ory

source Yes String Source vertex of an edge

target Yes String Target vertex of an edge

label No String Edge label

sortKey No String/Int/ Sort key value of duplicate edges.


Null

properties Yes Object Value of each property

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 465
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-379 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.


● 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 Request
Update edge properties in batches. The source vertex of the edge is 46, and the
target vertices of the edge are 39 and 38.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/properties/action?
action_id=batch-update
{
"edges": [
{
"source": "46",
"target": "39",
"properties": {
"Rating": [
5
],
"Datetime": [
"2018-01-0120:30:05"
]
}
},
{
"source": "46",
"target": "38",
"index": "0",
"properties": {
"Rating": [
4
],
"Datetime": [
"2018-01-0120:30:05"
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 466
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

}
],
"ignoreError": true
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage":"edge source vertex [46] does not exist",
"errorCode":"GES.8221"
}

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.

5.2.4 Metadata Operation APIs

5.2.4.1 Adding a Label

Function
This API is used to add a label.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 467
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels

Table 5-380 URI parameters


Paramete Mandato Type Description
r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Request Parameters
● Request parameters (OBS scenario)

Table 5-381 Request body parameters


Paramet Mandato Type Description
er ry

name Yes String Name of a label


A label name can contain a
maximum of 256 characters.
Only letters, digits, spaces, and
special characters %,@,#,$,:,?,*, .,+,-
are allowed.

type No String Label type, indicating that the label


is used for vertices or edges. The
options are as follows:
● vertex: indicates that the label is
used for vertices.
● edge: indicates that the label is
used for edges.
● all: indicates that the label is used
for vertices and edges.
The default value is all.

properties Yes Object Properties you want to add to the


label. For details about the
parameters, see Table 5-382.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 468
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-382 properties parameter description


Paramet Mandato Type Description
er ry

property No Object Label properties. For details about the


parameters, see Table 5-383.

Table 5-383 property parameters


Paramete Mandatory Type Description
r

name Yes String Property name


1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain
<, >, &, ASCII 14,15 or 30.
3. The property under a label must
be unique.

cardinality Yes String Composite type of a property.


Currently, only single is supported.

dataType Yes String Data type of a property. For details,


see the metadata types in
Specification Description.

● Request parameters (HDFS scenario)

Table 5-384 Request body parameters


Parameter Mandator Type Description
y

name Yes String Name of a concept. The value is a


string of 1 to 63 characters that
consist of uppercase letters,
lowercase letters, digits, and
underscores (_), for example,
"gene".

properties Yes List data Property list of a concept. Each


structure. concept contains a maximum of
For 255 properties.
details,
see Table
5-385.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 469
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandator Type Description


y

relations No List data Relation list of a concept. Each


structure. concept contains a maximum of
For 255 relations.
details,
see Table
5-386.

NOTE

Every concept must have the name property.

Table 5-385 Property parameters


Parameter Mandatory Type Description

name Yes String Property name. The value


contains 1 to 63 characters,
including uppercase letters,
lowercase letters, digits, and
underscores (_), and cannot
start with an underscore, for
example, cited_times. The
value cannot be reserved
property names id or label.

type No Enumerati Property type. The default


on value is single_string.
Available values include
single_string, set_string,
single_int, set_int,
single_double, set_double,
single_bool.

Table 5-386 Relation parameters


Parameter Mandatory Type Description

name Yes String Name of a relation between


concepts. The value can
contain 1 to 63 characters.
Only letters, digits, and
underscores (_) are allowed,
for example, cited_times.

target Yes String Target concept of the current


relation

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 470
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-387 Parameter description

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.


● 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.

cause String System prompt. If execution succeeds, this


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

Example Request
Add a label. The label name is book. The label has one property to add.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/labels
{
"name": "book",
"type": "vertex",
"properties": [
{
"property": {
"name": "Title",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Version",
"cardinality": "single",
"dataType": "string"
}
}
]
}

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 471
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "label already exists",
"errorCode": "GES.8801"
}

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.

5.2.4.2 Updating a Label

Function
In the current version, this API can only add properties to the end of existing
labels, but cannot delete existing properties or update the property sequence.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema?label={labelName}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 472
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-388 URI parameters


Paramete Mandato Type Description
r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

label_nam Yes String Label name


e

Request Parameters

Table 5-389 Request body parameters


Paramete Mandator Type Description
r y

type No String Label type, indicating that the label is


used for vertices or edges. The options
are as follows:
● vertex: indicates that the label is used
for vertices.
● edge: indicates that the label is used
for edges.
● all: indicates that the label is used for
vertices and edges.
The default value is all.

properties Yes Object Property array to be appended. Table


5-390 describes the parameters in an
array.

Table 5-390 properties parameter description


Paramet Mandator Type Description
er y

property No Object Label properties. For details about the


parameters, see Table 5-391.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 473
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-391 property parameters


Parameter Mandatory Type Description

name Yes String Property name


1. A property name can contain a
maximum of 256 characters.
2. A property name cannot contain <, >,
&, ASCCI 14,15 and 30.
3. The property under a label must be
unique.

cardinality Yes String Composite type of a property. Currently,


only single is supported.

dataType Yes String Data type of a property. For details, see


the metadata types in Specification
Description.

Response Parameters

Table 5-392 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.


● 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 Request
Update a label. The label name is book. The label has one property to update.
POST /ges/v1.0/{project_id}/graphs/{graph_name}/schema?label={labelName}
{
"type": "vertex",
"properties": [
{
"property": {

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 474
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"name": "Title",
"cardinality": "single",
"dataType": "string"
}
},
{
"property": {
"name": "Version",
"cardinality": "single",
"dataType": "string"
}
}
]
}

NOTE

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

Example Response
Status code: 200

Example response (successful request)


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

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "label already exists",
"errorCode": "GES.8801"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 475
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.4.3 Querying Labels

Function
This API is used to query a label.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema?label={labelName}

Table 5-393 URI parameters

Paramete Mandato Type Description


r ry

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

label_nam Yes String Label name


e

Response Parameters

Table 5-394 Parameter description

Parameter Type Description

data data Query results. This parameter is left blank when


Object the request fails.

result String Request result. If the request is successful, the


value is success. If the request fails, the value is
failed.

errorMessag String System prompt


e ● 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 code


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 476
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-395 data parameter description


Parameter Type Description

properties Object Property array.

type String Label type, indicating that the label is used for
vertices or edges.

Example Request
Query labels.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema?label={labelName}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"type": "vertex",
"properties": [
{
"name": "Rating",
"type": "int",
"cardinality": "single"
},
{
"name": "Datetime",
"type": "string",
"cardinality": "single"
}
]
},
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8204"
}

Status Codes
Return Value Description

400 Bad Request Request error.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 477
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.2.4.4 Querying Graph Metadata Details

Function
This API is used to query graph metadata details.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema

Table 5-396 URI parameters

Parameter Mandato Type Description


ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Response Parameters

Table 5-397 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 478
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

errorCode String System prompt.


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

data Object Query results. This parameter is left blank when


the request fails.

Table 5-398 data parameter description

Parameter Type Description

schema List Definition of each label and their associated


property fields

Table 5-399 schema parameter description

Parameter Type Description

label String label name

properties Object Property array. For details, see properties


parameter description.

type String Label type, indicating that the label is used for
vertices or edges.

Table 5-400 properties parameter description

Parameter Type Description

name String Property name


1. A property name can contain a maximum of
256 characters.
2. A property name cannot contain <, >, &,
ASCII 14, 15, or 30.
3. The property under a label must be unique.

cardinality String Composite type of a property. Currently, only


single is supported.

dataType String Data type of a property. For details, see the


metadata types in Specification Description.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 479
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Query metadata details of a graph.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"data": {
"schema": [
{
"label": "__DEFAULT__",
"type": "all"
},
{
"label": "friends",
"type": "vertex"
},
{
"label": "movie",
"type": "vertex",
"properties": [
{
"name": "ChineseTitle",
"type": "string",
"cardinality": "single"
},
{
"name": "Year",
"type": "int",
"cardinality": "single"
}
]
},
{
"label": "user",
"type": "vertex",
"properties": [
{
"name": "Name",
"type": "string",
"cardinality": "single"
},
{
"name": "Occupation",
"type": "string",
"cardinality": "single"
},
{
"name": "Zip-code",
"type": "string",
"cardinality": "single"
}
]
},
{
"label": "rate",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 480
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"type": "edge",
"properties": [
{
"name": "Score",
"type": "int",
"cardinality": "single"
},
{
"name": "Datetime",
"type": "date",
"cardinality": "single"
}
]
}
]
}
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8003"
}

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.

5.2.5 Index Operation APIs

5.2.5.1 Creating an Index

Function
This API is used to create indexes based on the specified information such as
indexName and IndexType. Currently, composite indexes and full-text indexes are
supported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 481
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

● Composite indexes include GlobalCompositeVertexIndex,


GlobalCompositeEdgeIndex, CompositeVertexIndex, and
CompositeEdgeIndex. A composite index is created for a fixed combination
of properties. A local index can be created on a specified label. You do not
need to specify a label for a global composite index. As long as a label
contains a specified property, an index is automatically created on the label.
Indexes can be used to accelerate queries.
● Full-text indexes (FullTextIndex) can implement functions such as full-text
search and fuzzy search. If you search data immediately after an update, you
may get the old data. You are advised to query the data 1 second after the
update. For details about how to use full-text indexes, see Querying Vertices
That Meet Filter Criteria and Querying Edges That Meet Filter Criteria.
You can also use full-text indexes in Cypher statements. For details, see
Performing Cypher Queries.
NOTE

● Currently, the full-text indexing feature is supported only in the ECS/BMS+MRS


deployment mode.
● After an index is created, wait for 30 seconds for index synchronization. After the
synchronization is complete, Cypher queries can be accelerated using the index.

Indexes
Feature Fuzzy Search Speed Flexibility

Composite No Fast Fixed composite property keys


indexes only

Full-text Yes Slower than Randomly combined property


indexes composite keys
indexes

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/indices

Table 5-401 URI parameters


Paramete Mandatory Type Description
r

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining
a Project ID.

graph_na Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 482
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-402 Request body parameters


Parameter Mandato Type Description
ry

indexName Yes String Index name. Only letters, digits, hyphens


(-), and underscores (_) are allowed. Other
characters are not allowed. The index name
can contain a maximum of 63 characters.

indexType Yes String Index type, which is case sensitive


● GlobalCompositeVertexIndex is a
global composite vertex index.
● GlobalCompositeEdgeIndex is a global
composite edge index.
● FullTextIndex is a full-text index.

hasLabel No Boolean Whether labels exist. The default value is


false.
● true
● false

indexLabel No List Labels on which indexes are created. This


parameter is available only when
indexType is set to CompositeVertexIndex
or CompositeEdgeIndex. This parameter is
mandatory.

indexPrope No (If String Index property list.


rty hasLabel The property types that can be used to
is false create indexes include integer, float, double,
or null, long, enum, char array, string, and date.
this
paramete
r is
mandato
ry.)

NOTE

● If a property is of the string or char array type, the value must be no more than 40
bytes. The excess part will be deleted.
● Cypher queries can be accelerated with indexes whose hasLabel is True.
● If indexProperty is left blank, the created index is a label index, which accelerates
label filtering.
● If indexProperty is specified, the created index is a property index, which
accelerates property filtering.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 483
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-403 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.


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

jobId String ID of an asynchronous job


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

jobType Integer Type of an asynchronous job

result String If the execution is successful, the value of


result is success.

Example Request
Create a composite index. The index name is ageIndex and the index type is
global vertex index.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
"indexName": "ageIndex",
"indexType": "GlobalCompositeVertexIndex",
"hasLabel": true,
"indexProperty": []
}

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 484
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"jobType": 8
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8603"
}

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.

5.2.5.2 Deleting an Index

Function
This API is used to delete an index based on the specified indexName.

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}/indices/{indexName}

Table 5-404 URI parameters

Paramet Mandat Type Description


er ory

project_i Yes String Project ID. For details about how to obtain
d the project ID, see Obtaining a Project ID.

graph_na Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 485
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramet Mandat Type Description


er ory

indexNa Yes String Index name


me

Response Parameters

Table 5-405 Parameter description

Parameter Type Description

errorMessag String System prompt.


e ● 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.


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

jobType Integer Type of an asynchronous job

Example Request
Delete an index by name. The index name is ageIndex.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices/ageIndex

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "fb74314e-a82d-41b2-8900-96e2559fa0d9000168232",
"jobType": 9
}

Status code: 400

Example response (failed request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 486
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Http Status Code: 400


{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8604 "
}

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.

5.2.5.3 Querying Indexes

Function
This API is used to query all indexes created on a graph.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/indices

Table 5-406 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 487
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-407 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.


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

data Object Index data you want to query

result String Query results. If the query is successful,


success is displayed.

indices List Indexes of the query results

indexType String Index types of the query results

indexName String Index names of the query results

indexLabel List Labels of local indexes

indexProperty List Index properties of the query results

hasLabel Boolean Whether the indexes of the query results


contain labels
NOTE
For full-text indexes, the default value is false.

Example Request
Query all indexes created on a graph.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices

NOTE

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

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 488
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"data": {
"indices": [
{
"indexType": "GlobalCompositeVertexIndex",
"indexName": "ageIndx",
"indexProperty": [
"age"
],
"hasLabel": true

}
]
},
"result": "success"
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8605"
}

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.

5.2.5.4 Creating Indexes in Batches

Function
This API is used to create indexes in batches. By doing so, the number of data
scans is reduced and the overall time required is shorten. The types of indexes that
can be created are the same as those of the index creation API. For details, see
Creating an Index.

NOTE

After an index is created, wait for 30 seconds for index synchronization. After the
synchronization is complete, Cypher queries can be accelerated using the index.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 489
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/ indices/action?action_id=batch-
build

Table 5-408 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Request Parameters

Table 5-409 Request body parameter


Parameter Mandator Type Description
y

indices Yes Array Index array. The number of new indexes


cannot exceed the maximum number of
supported indexes minus the number of
existing indexes. Currently, a maximum of
10 indexes can be created. For details about
index parameters, see Table 2.

Table 5-410 indices parameter description


Parameter Mandato Type Description
ry

indexName Yes String Index name. Only letters, digits, hyphens


(-), and underscores (_) are allowed. The
index name can contain a maximum of 63
characters.

indexType Yes String Index type, which is case sensitive


● GlobalCompositeVertexIndex is a
global composite vertex index.
● GlobalCompositeEdgeIndex is a global
composite edge index.
● FullTextIndex is a full-text index.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 490
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandato Type Description


ry

hasLabel No Boolean Whether labels exist. The default value is


false.
● true
● false

indexPrope No (If String Index property list


rty hasLabel Indexes can be created for the following
is false property types: integer, float, double,
or null, long, enum, char array, string, and date.
this
paramete
r is
mandato
ry.)

NOTE

● If a property is of the string or char array type, the value must be no more than 40
bytes. The excess part will be deleted.
● Cypher queries can be accelerated with indexes whose hasLabel is True.
● If indexProperty is left blank, the created index is a label index, which accelerates
label filtering.
● If indexProperty is specified, the created index is a property index, which
accelerates property filtering.

Response Parameters

Table 5-411 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 491
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

jobId String ID of an asynchronous job


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

jobType Integer Type of an asynchronous job

result String If the execution is successful, the value is


success.

Example Request
Create multiple composite indexes at a time. The index names are vertexIndex,
edgeIndex, and useridIndex.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices/action?action_id=batch-build
{
"indices": [
{
"indexName": "vertexIndex",
"indexType": "GlobalCompositeVertexIndex",
"hasLabel": true,
"indexProperty": []
},
{
"indexName": "edgeIndex",
"indexType": "GlobalCompositeEdgeIndex",
"hasLabel": true,
"indexProperty": []
},
{
"indexName": "useridIndex",
"indexType": "GlobalCompositeEdgeIndex",
"hasLabel": false,
"indexProperty": [
"userid"
]
}
]
}

NOTE

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
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232",
"jobType": 8
}

Status code: 400

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 492
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response for a failed request


Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8603"
}

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.

5.2.6 HyG Graph Management APIs

5.2.6.1 Creating a HyG Graph

Function
This API is used to create a HyG graph.

NOTE

Computing of graphs of the database edition relies on the HyG engine. Before executing an
algorithm, you need to create a HyG graph and synchronize data from the graph database
to the HyG engine.

URI
POST /ges/v1.0/{project_id}/hyg/{graph_name}

Table 5-412 URI parameters

Parameter Mandato Type Description


ry

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 493
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandato Type Description


ry

graph_nam Yes String Graph name


e

Request Parameters

Table 5-413 Request body parameters

Parameter Mandato Type Description


ry

policy No String Graph partitioning policy. Currently, the


oec policy is supported. The default policy
is oec.

inEdge No Boolean Whether the graph contains incoming


edges. The default value is false. If this
parameter is set to true, the data
synchronization performance will be
affected.
For some algorithms, such as
shortest_path, sssp, and k_hop, if the
incoming edges are not contained, the
algorithm performance may deteriorate or
an error may be reported. For details, see
the parameter description of the
corresponding algorithm.

Response Parameters

Table 5-414 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 code


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 494
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

result String Execution results


● If the execution is successful, the value is
success.
● If the execution fails, the value is failed.

Example Request
To create a HyG graph, set the partitioning policy to oec and configure the graph
to contain incoming edges.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/hyg/{graph_name}
{
"policy": "oec",
"inEdge": true
}

NOTE

SERVER_URL: URL for accessing the 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"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorCode": "GES.8011",
"errorMessage": "graph : movie2 is not exist"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 495
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes for Service Plane APIs.

5.2.6.2 Synchronizing HyG Graph Data

Function
This API is used to synchronize graph database updates to the HyG computing
engine.

URI
POST /ges/v1.0/{project_id}/hyg/{graph_name}/sync

Table 5-415 URI parameters

Paramet Mandat Type Description


er ory

project_i Yes String Project ID. For details about how to obtain
d the project ID, see Obtaining a Project ID.

graph_na Yes String Graph name


me

Request Parameters

Table 5-416 Request body parameters

Paramet Mandat Type Description


er ory

vertex No JSON Vertex property list. If the list is empty, vertex


properties will not be synchronized. For
details about the parameters, see Table
5-417.
During the initial data synchronization, this
parameter will be applied. For subsequent
synchronizations, this parameter will default
to the value specified during the first
synchronization.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 496
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramet Mandat Type Description


er ory

edge No JSON Edge property list. If the list is empty, edge


properties will not be synchronized. For
details about the parameters, see Table
5-417.
During the initial data synchronization, this
parameter will be applied. For subsequent
synchronizations, this parameter will default
to the value specified during the first
synchronization.

Table 5-417 vertex and edge parameters


Paramet Mandat Type Description
er ory

label Yes String Label name

property Yes Array of Property name. The property must belong to


strings the label.

Response Parameters

Table 5-418 Parameter description


Parameter Type Description

errorMessag String System prompt


e ● 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 code


● 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 view the job execution status and obtain
the return result by querying the job ID. For
details, see Job Management APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 497
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

Suspended edges in a graph database (edges that do not have either a source or a target
node) are not synchronized to the HyG engine.

Example Request
Synchronize the update information of the graph database to the HyG computing
engine, with an empty vertex property list, an edge property list with the property
name Rating, and a label name of rate.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/hyg/{graph_name}/sync
{
"vertex": [],
"edge": [
{
"property": [
"Rating"
],
"label": "rate"
}
]
}

NOTE

SERVER_URL: URL for accessing the 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
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorCode": "GES.8011",
"errorMessage": "graph : movie2 is not exist"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 498
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes for Service Plane APIs.

5.2.6.3 Querying General Information About a HyG Graph

Function
This API is used to query general information about a HyG graph, such as the
number of vertices, number of edges, properties, and partitioning policies.

URI
GET /ges/v1.0/{project_id}/hyg/{graph_name}/summary

Table 5-419 URI parameters

Parameter Mandat Type Description


ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Request Parameters
None

Response Parameters

Table 5-420 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 499
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

errorCode String System prompt code


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

data Object If the query is successful, the data field is


returned. For details about the parameters,
see Table 5-421.

status String Job status returned for a successful query.


Possible values are waiting, running, and
complete. This parameter is left blank when
the query fails.

result String Execution results


● If the execution is successful, the value is
success.
● If the execution fails, the value is failed.

Table 5-421 data parameter description

Parameter Type Description

vertex JSON Vertex labels and properties

edge JSON Edge labels and properties

policy String Partitioning policy

inEdge Boolean Whether incoming edges are contained

idIndex Boolean Whether the vertex ID index is contained

updateTime String Time when a graph is updated

vertexNum Integer Number of vertices

edgeNum Integer Number of edges

Example Request
Query general information about a HyG graph.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/hyg/{graph_name}/summary

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 500
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200
Example response for a successful request
Http Status Code: 200
{
"data": {
"inEdge": true,
"idIndex": true,
"policy": "oec",
"updateTime": "2023-08-03 15:13:16",
"vertex": [],
"edge": [
{
"label": "rate",
"property": [
"Rating"
]
}
],
"vertexNum": 150,
"edgeNum": 1659
},
"result": "success"
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{
"status": "complete",
"errorCode": "GES.8011",
"errorMessage": "graph [movie2] is not found",
"result": "failed"
}

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 for Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 501
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.6.4 Deleting a HyG Graph

Function
This API is used to delete a HyG graph.

URI
DELETE /ges/v1.0/{project_id}/hyg/{graph_name}

Table 5-422 URI parameters

Parameter Mandat Type Description


ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

graph_nam Yes String Graph name


e

Request Parameters
None

Response Parameters

Table 5-423 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 code


● 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 view the job execution status and
obtain the return result by querying the job ID.
For details, see Job Management APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 502
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

status String Job status returned for a successful query.


Possible values are waiting, running, and
complete. This parameter is left blank when
the query fails.

result String Execution results


● If the execution is successful, the value is
success.
● If the execution fails, the value is failed.

Example Request
Delete a HyG graph.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/hyg/{graph_name}

NOTE

SERVER_URL: URL for accessing the 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
{
"jobId": "fb74314e-a82d-41b2-8900-96e2559fa0d9000168232"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"status": "complete",
"errorCode": "GES.8011",
"errorMessage": "graph [movie2] is not found",
"result": "failed"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 503
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes for Service Plane APIs.

5.2.6.5 Listing HyG Graphs

Function
This API is used to list HyG graphs.

URI
GET /ges/v1.0/{project_id}/hyg

Table 5-424 URI parameter


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to obtain
the project ID, see Obtaining a Project ID.

Request Parameters
None

Response Parameters

Table 5-425 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 504
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

errorCode String System prompt code


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

data Object If the query is successful, the data field


is returned. For details about the
parameters, see Table 5-426.

result String Execution results


● If the execution is successful, the
value is success.
● If the execution fails, the value is
failed.

Table 5-426 data parameter description


Parameter Type Description

name String Graph name

vertex JSON Vertex labels and properties

edge JSON Edge labels and properties

policy String Partitioning policy

inEdge Boolean Whether incoming edges are contained

idIndex Boolean Whether the vertex ID index is contained

updateTime String Time when a graph is updated

vertexNum Integer Number of vertices

edgeNum Integer Number of edges

Example Request
List HyG graphs.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/hyg

NOTE

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 505
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Response
Status code: 200

Example response for a successful request


Http Status Code: 200
{
"data": [
{
"name": "test",
"inEdge": true,
"idIndex": true,
"policy": "oec",
"vertexNum": 0,
"edgeNum": 0
},
{
"name": "movie",
"inEdge": true,
"idIndex": false,
"policy": "oec",
"updateTime": "2023-11-15 18:11:00",
"vertex": [],
"edge": [],
"vertexNum": 146,
"edgeNum": 1659
}
],
"result": "success"
}

Status code: 400

Example response for a failed request


HttpStatusCode: 404
{
"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 for Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 506
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.7 HyG Algorithm APIs

5.2.7.1 Running Algorithms

Function
This API is used to run specified algorithms based on entered parameters.

URL
POST /ges/v1.0/{project_id}/graphs/{graph_name}/hyg/algorithm

Table 5-427 URI parameters


Paramete Mandator Type Description
r y

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Example Request
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/hyg/algorithm
{
"algorithmName":"pagerank",
"data_id": "0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"alpha":0.85,
"convergence":0.00001,
"max_iterations":1000,
"directed":true
}
}

Request Parameters
For details about the parameters, see Common algorithm parameters.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 507
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-428 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.


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

jobId String ID of the algorithm execution job. This


parameter is left blank if the request fails.
NOTE
You can view the job execution status and obtain
the return result by querying the job ID. For details,
see Job Management APIs.

Example Response
Status code: 200

Example response for a successful request


Http Status Code: 200
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"status": "complete",
"errorCode": "GES.8011",
"errorMessage": "graph : movie2 is not exist",
"result": "failed"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 508
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

403 Forbidden No operation permissions.

404 Not Found No resources found.

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

5.2.7.2 Algorithm API Parameter Reference

5.2.7.2.1 Common Algorithm Parameters

Request Parameters

Table 5-429 Request body parameters


Parameter Mandatory Type Description

algorithmNa Yes String Algorithm name


me Available values are as follows
(algorithm names you can call):
● pagerank
● kcore
● k_hop
● shortest_path
● sssp
● connected_component

data_id Yes String Dataset ID. For details about


how to obtain the dataset ID,
see section 5.4.0 "HyG Dataset
Management."

parameters Yes Object Algorithm parameters. For


details, see the parameter
description of each algorithm.

Example Response
Algorithms are executed based on input parameters. You can call Querying Job
Status and Execution Results to use the job_id returned by the algorithm to
obtain the algorithm execution result.
Status code: 200
Example response for a successful request

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 509
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"data": {
"outputs": {
$response_data //Result of each algorithm. The results vary with the algorithm.
"runtime": 1.365867,
"data_return_size": 3,
"data_offset": 0,
"data_total_size": 100
}
},
"status": "complete"
}

NOTE

response_data indicates the result of each algorithm. The results vary with algorithms.

Status code: 400


Example response for a failed request
Http Status Code: 400
{
"errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
"errorCode":"GES.8301"
}

5.2.7.2.2 Shortest Path

Function
This API is used to execute the Shortest Path algorithm based on entered
parameters.
The Shortest Path algorithm is used to find the shortest path between two nodes
in a graph.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-430 URI parameters


Paramete Mandato Type Description
r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graphNa Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 510
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-431 Request body parameters


Parameter Mandato Type Description
ry

algorithmNa Yes String Algorithm name


me

data_id Yes String Dataset ID. For details about


how to obtain the dataset ID,
see section 5.4.0 "HyG Dataset
Management."

parameters Yes parameters Algorithm parameters


Object

Table 5-432 parameters


Parameter Mandat Type Description
ory

source Yes String Source vertex ID of a path

target Yes String Target vertex ID of a path, which is not


the same as the source vertex ID

directed No Boolea Whether to consider the edge direction.


n The value can be true or false.
NOTE
● false: The current version does not support
this function on weighted graphs.
● When the dataset does not contain
incoming edges, if this parameter is set to
true and an algorithm that does not
depend on incoming edges is selected to
calculate the output, the performance
deteriorates. If this parameter is set to
false, an error is reported.

weight No String Weight of an edge. The value can be


empty or a string.
● Empty: The default weight and
distance of edges are 1.
● String: The property of the edge is the
weight. If the edge does not have a
property, the weight is 1 by default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 511
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response 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. If execution succeeds, this


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

jobId String ID of the algorithm execution job. This parameter


is left blank if the request fails.
NOTE
You can use the returned job ID to view the task
execution status and obtain the algorithm return result.
For details, see Querying Job Status on the Service
Plane.

jobType Integer Job type. This parameter is left blank if the


request fails.

Example Request
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"shortest_path",
"data_id":"0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"source":"1",
"target":"5",
"directed":true,
"weight":"",
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 512
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"errorMessage":"graph [demo] is not found",


"errorCode":"GES.8402"
}

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.

5.2.7.2.3 SSSP

Function
This API is used to execute the SSSP algorithm based on entered parameters.
This algorithm provides the shortest path from a given node (source node) to all
other nodes.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-433 URI parameters


Paramete Mandato Type Description
r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graphNa Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 513
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-434 Request body parameters


Parameter Mandato Type Description
ry

algorithmNa Yes String Algorithm name


me

data_id Yes String Dataset ID. For details about


how to obtain the dataset ID,
see section 5.4.0 "HyG Dataset
Management."

parameters Yes parameters Algorithm parameters


Object

Table 5-435 parameters


Parameter Mandat Type Description
ory

source Yes String Source vertex ID of a path

directed No Boolea Whether to consider the edge direction.


n The value can be true or false.
NOTE
● false: The current version does not support
this function on weighted graphs.
● When the dataset does not contain
incoming edges, if this parameter is set to
true and an algorithm that does not
depend on incoming edges is selected to
calculate the output, the performance
deteriorates. If this parameter is set to
false, an error is reported.

weight No String Weight of an edge. The value can be


empty or a string.
● Empty: The default weight and
distance of edges are 1.
● String: The property of the edge is the
weight. If the edge does not have a
property, the weight is 1 by default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 514
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-436 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. If execution succeeds, this


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

jobId String ID of the algorithm execution job. This parameter is


left blank if the request fails.
NOTE
You can use the returned job ID to view the task execution
status and obtain the algorithm return result. For details,
see Querying Job Status on the Service Plane.

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

Example Request
POST http://{SERVER_URL}/ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"sssp ",
"data_id":"0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"source":"1",
"directed":true,
"weight": "",
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 515
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"errorMessage":"graph [demo] is not found",


"errorCode":"GES.8402"
}

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.

5.2.7.2.4 K-Hop

Function
This API is used to run the K-Hop algorithm based on entered parameters.
This algorithm is used to search all nodes in the k layer that are associated with
the source node through Breadth-First Search (BFS). The found sub-graph is the
source node's ego-net. This algorithm returns the number of nodes in the ego-net.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-437 URI parameters


Paramete Mandato Type Description
r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graphNa Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 516
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-438 Request body parameters


Parameter Mandato Type Description
ry

algorithmNa Yes String Algorithm name


me

data_id Yes String Dataset ID. For details about


how to obtain the dataset ID,
see section 5.4.0 "HyG Dataset
Management."

parameters Yes parameters Algorithm parameters


Object

Table 5-439 parameters


Parameter Mandato Type Description
ry

k Yes Integer Number of hops. The value ranges from 1


to 100.

source Yes String ID of the start node

mode No String Search direction. Possible values are:


● OUT: Hop from the outgoing edges
(default value)
● IN: Hop from the incoming edges
● ALL: Hop along both incoming and
outgoing edges
NOTE
When the dataset does not contain incoming
edges, if this parameter is set to OUT and an
algorithm that does not depend on incoming
edges is selected to calculate the output, the
performance deteriorates. If this parameter is
set to IN or ALL, an error is reported.

switch No Integer When the number of activated edges


reaches the total number of edges/switch
value, the pull/push mode is switched.
The value ranges from 1 to 2000, and the
default value is 40.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 517
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response 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. If execution succeeds, this


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

jobId String ID of the algorithm execution job. This parameter is


left blank if the request fails.
NOTE
You can use the returned job ID to view the task execution
status and obtain the algorithm return result. For details,
see Querying Job Status on the Service Plane.

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

Example Request
POST http://{SERVER_URL}/ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"k_hop",
"data_id":"0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"k":3,
"source":66,
"mode":"ALL"
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 518
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.2.7.2.5 PageRank

Function
This API is used to run the PageRank algorithm based on entered parameters.

PageRank, also known as web page ranking, is a hyperlink analysis algorithm used
to rank web pages (nodes) based on their search engine results. PageRank is a
way of measuring the relevance and importance of web pages (nodes).

● If a web page is linked to many other web pages, the web page is important.
That is, the PageRank value of the web page is relatively high.
● If a web page with a high PageRank value is linked to another web page, the
PageRank value of the linked web page increases accordingly.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-440 URI parameters

Paramete Mandato Type Description


r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graphNa Yes String Graph name


me

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 519
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-441 Request body parameters


Parameter Mandator Type Description
y

algorithmN Yes String Algorithm name


ame

data_id Yes String Dataset ID. For details about how to


obtain the dataset ID, see section 5.4.0
"HyG Dataset Management."

parameters Yes paramet Algorithm parameters


ers
Object

Table 5-442 parameters


Parameter Mandato Type Description
ry

alpha No Double Weight coefficient (also called damping


coefficient) The value range is between 0
and 1, excluding 0 and 1. The default
value is 0.85.

convergence No Double Convergence. The value range is between


0 and 1, excluding 0 and 1. The default
value is 0.00001.

max_iteratio No Int Maximum iterations. The value ranges


ns from 1 to 2000. The default value is 1000.

Response 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. If execution succeeds, this


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 520
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

jobId String ID of the algorithm execution job. This


parameter is left blank if the request fails.
NOTE
You can use the returned job ID to view the task
execution status and obtain the algorithm return
result. For details, see Querying Job Status on the
Service Plane.

jobType Integer Job type. This parameter is left blank if the


request fails.

Example Request
POST http://{SERVER_URL}/ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"pagerank",
"data_id":"0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"alpha":0.85,
"convergence":0.00001,
"max_iterations":1000
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 521
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.2.7.2.6 Connected Component

Function
This API is used to run the Connected Component algorithm based on entered
parameters.

A connected component represents a sub-graph, in which all nodes are connected


to each other. Path directions are involved only in strongly connected components
and are not considered in weakly connected components. This algorithm
generates weakly connected components.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-443 URI parameters

Paramete Mandato Type Description


r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graphNa Yes String Graph name


me

Request Parameters

Table 5-444 Request body parameters

Parameter Mandator Type Description


y

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 522
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

algorithmN Yes String Algorithm name


ame

data_id Yes String Dataset ID. For details about how to


obtain the dataset ID, see section 5.4.0
"HyG Dataset Management."

parameters Yes Object Algorithm parameters

Response 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. If execution succeeds, this


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

jobId String ID of the algorithm execution job. This parameter is


left blank if the request fails.
NOTE
You can use the returned job ID to view the task execution
status and obtain the algorithm return result. For details,
see Querying Job Status on the Service Plane.

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

Example Request
POST http://{SERVER_URL}/ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"connected_component",
"data_id": "0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 523
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"jobType": 1
}

Status code: 400


Example response for a failed request
Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

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.

5.2.7.2.7 K-core

Function
This API is used to run the K-core algorithm based on entered parameters.
K-core is a classic graph algorithm used to calculate the number of cores of each
node. The calculation result is one of the most commonly used reference values
for determining the importance of a node so that the propagation capability of
the node can be better understood.

URI
POST /ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm

Table 5-445 URI parameters

Paramete Mandato Type Description


r ry

projectId Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 524
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Paramete Mandato Type Description


r ry

graphNa Yes String Graph name


me

Request Parameters

Table 5-446 Request body parameters


Parameter Mandator Type Description
y

algorithmN Yes String Algorithm name


ame

data_id Yes String Dataset ID. For details about how to


obtain the dataset ID, see section 5.4.0
"HyG Dataset Management."

parameters Yes paramet Algorithm parameters


ers
Object

Table 5-447 parameters


Parameter Mandato Type Description
ry

k Yes Integer Number of cores. The algorithm returns


vertices whose number of cores is greater
than or equal to k. The value must be
greater than or equal to 0.

Response 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. If execution succeeds, this


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 525
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

jobId String ID of the algorithm execution job. This parameter


is left blank if the request fails.
NOTE
You can use the returned job ID to view the task
execution status and obtain the algorithm return result.
For details, see Querying Job Status on the Service
Plane.

jobType Integer Job type. This parameter is left blank if the


request fails.

Example Request
POST http://{SERVER_URL}/ges/v1.0/{projectId}/graphs/{graphName}/hyg/algorithm
{
"algorithmName":"kcore",
"data_id":"0-91494cd9-e7da-4fb9-ba56-b2301967688d0000000019090",
"parameters":{
"k":10
}
}

NOTE

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
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

Status Codes
Return Value Description

400 Bad Request Request error.

401 Unauthorized Authorization failed.

403 Forbidden No operation permissions.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 526
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

404 Not Found No resources found.

500 Internal Server Error Internal server error.

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes.

5.2.8 HyG Job Management APIs

5.2.8.1 Dumping HyG Algorithm Results

Function
This API is used to dump the execution results of the algorithm (jobId) to OBS.

URI
POST /ges/v1.0/{project_id}/hyg/{graph_name}/jobs/{job_id}/export-result

Table 5-448 URI parameters

Parameter Mandator Type Description


y

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

job_id Yes String Job ID of the algorithm task in the


response result

Request Parameters

Table 5-449 Request body parameters

Parameter Mandat Type Description


ory

exportPath Yes String Dump path

obsParameters Yes String OBS authentication parameters. For


details, see Table 5-450.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 527
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandat Type Description


ory

erase No Boolean Whether to delete the original job


result after dumping. The value can
be true or false. The default value is
true, indicating that the job result is
deleted and resources are released by
default.

Table 5-450 obsParameters parameter description

Parameter Manda Type Description


tory

accessKey Yes string AK

secretKey Yes string SK

Response Parameters

Table 5-451 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 code


● 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. This parameter is


left blank if the request fails.
NOTE
You can use the returned job ID to view the task
execution status and obtain the algorithm return
result. For details, see Job Management APIs.

Example Request
Dumps algorithm results and returns the job ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 528
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

POST /ges/v1.0/{project_id}/hyg/{graph_name}/jobs/{job_id}/export-result
{
"exportPath": "demo_movie/",
"erase": true,
"obsParameters": {
"accessKey": "xxxx",
"secretKey": "xxxx"
}
}

NOTE

SERVER_URL: URL for accessing the 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
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400


Example response for a failed request
HttpStatusCode: 400
{
"errorCode": "GES.8011",
"errorMessage": "graph : movie2 is not exist"
}

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 for Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 529
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.8.2 Canceling a HyG Job

Function
This API is used to cancel a submitted HyG job. (Currently, only jobs in a queue
can be canceled.)

URI
DELETE /ges/v1.0/{project_id}/hyg/{graph_name}/jobs/{job_id}

Table 5-452 URI parameters


Parameter Mandator Type Description
y

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

job_id Yes String Job ID of the algorithm task in the


response result

Request Parameters
None

Response Parameters

Table 5-453 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 code


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 530
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

result String Execution results


● If the execution is successful, the value is
success.
● If the execution fails, the value is failed.

Example Request
● Example request 1: Cancel a submitted job.
DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}

● Example request 2: Cancel all jobs in a queue.


DELETE http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/jobs

NOTE

SERVER_URL: URL for accessing the 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"
}

Status code: 400

Example response for a failed request


HttpStatusCode: 400
{
"errorMessage": "Graph [
{project_id}
-movie1] does not exist, please check project_id and graph_name.",
"errorCode": "GES.8000",
"result": "failed"
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 531
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

503 Service Unavailable Service unavailable.

Error Codes
See Error Codes for Service Plane APIs.

5.2.9 Native Algorithm APIs

5.2.9.1 Executing an Algorithm

Function
This API is used to run specified algorithms based on entered parameters.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
algorithm

Table 5-454 URI parameters

Paramete Mandator Type Description


r y

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Example Request
Run the shortest_path algorithm to find the shortest route between vertices 46
and 138, taking into account the direction of the edges.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-algorithm
{
""algorithmName"":""shortest_path"",
""executionMode"": ""sync"",
""parameters"":{
""source"":""46"",
""target"":""138"",
""directed"":true
}
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 532
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

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

Request Parameters
For details about the parameters, see Common algorithm parameters.

Response Parameters

Table 5-455 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.


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

jobId String ID of the algorithm execution job. This


parameter is left blank when the request fails.
NOTE
You can view 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 when the
request fails.

Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200
{
"jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122",
"jobType": 1
}

Status code: 4200


Example response (failed request)
Http Status Code: 400
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 533
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"errorMessage":"graph [demo] is not found",


"errorCode":"GES.8402"
}

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.

5.2.9.2 Algorithm API Parameter References

5.2.9.2.1 Common Algorithm Parameters

Request Example
{
"algorithmName":"XXX",
"parameters":{
...
}
}

Request Parameters

Table 5-456 Request body parameters

Parameter Mandat Type Description


ory

algorithmN Yes String Algorithm name.


ame Available values are as follows (algorithm
names you can call):
● shortest_path
● shortest_path_of_vertex_sets
● common_neighbors_of_vertex_sets

parameters Yes Object Algorithm parameters. For details, see the


parameter description of each algorithm.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 534
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-457 New Body parameters of version 2.1.7

Parameter Mandat Type Description


ory

executionM No String ● sync: synchronous


ode ● async: asynchronous
The default value is async.
Supported algorithms are as follows
(algorithm names you can call):
● shortest_path
● shortest_path_of_vertex_sets

offset No Integer Synchronization result offset. The default


value is 0.
NOTE
This parameter is available when
executionMode is sync.
Supported algorithms are as follows
(algorithm names you can call):
● shortest_path
● shortest_path_of_vertex_sets
● common_neighbors_of_vertex_sets

limit No Integer Maximum number of returned


synchronization results. The maximum
value is 100000. The default value is
100000.
NOTE
This parameter is available when
executionMode is sync.
Supported algorithms are as follows
(algorithm names you can call):
● shortest_path
● shortest_path_of_vertex_sets
● common_neighbors_of_vertex_sets

Example Response
Algorithms are executed based on input parameters. You can call Querying Job
Status and Execution Results to use the job_id returned by the algorithm to
obtain the algorithm execution result.

Status code: 200

Example response (successful request)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 535
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

{
"data": {

"outputs": {
$response_data //Result of each algorithm. The results vary with the algorithm.
"runtime": 1.365867,
"data_return_size": 3,
"data_offset": 0,
"data_total_size": 100
}
},
"status": "complete"
}

NOTE

response_data indicates the result of each algorithm. The results vary with algorithms.

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
"errorCode":"GES.8301"
}

Response Parameters

Table 5-458 Response body parameters

Parameter Type Description

errorMessa String System prompt. If execution succeeds, this parameter


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

errorCode String System prompt. If execution succeeds, this parameter


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

status String Returned job status for a successful query. Possible


values are waiting, running, and complete. This
parameter is left blank when the query fails.

data Object Algorithm execution result. This parameter is left blank


when the query fails.

5.2.9.2.2 Shortest Path

Table 5-459 parameters parameter description

Parameter Mandatory Type Description

source Yes String Source vertex ID of a path

target Yes String Target vertex ID of a path

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 536
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

directed No Boolean Whether to consider the edge direction. The


value is true.

timeWindow No Object Time window for time filtering. For details,


see Table 5-460.
NOTE
timeWindow does not support the shortest path
with weight. That is, parameters timeWindow and
weight cannot be both specified.

Table 5-460 timeWindow parameter description


Parameter Mandatory Type Description

filterName Yes String Character string: The property on the


corresponding vertex/edge is used as the
time.

filterType No String Filters vertices or edges. The default value is


BOTH.
● V: filtering by vertex
● E: filtering by edge
● BOTH: filtering by vertex and edge

startTime No String Start time, which is a string of the date type


or a timestamp.

endTime No String End time, which is a string of the date type or


a timestamp.

Table 5-461 response_data parameter description


Parameter Type Description

path List Shortest path. The format is as follows:


[vertexId,...]
where
vertexId is of the string type.

source String Source vertex ID

target String Target vertex ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 537
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.9.2.3 Shortest Path of Vertex Set

Table 5-462 Parameter description


Paramet Ma Descri Type Value Range Defa
er nda ption ult
tor Value
y

sources Yes Sourc String The value is in the standard CSV -


e format. IDs are separated by
vertex commas (,), for example, Alice,
ID set Nana.
The maximum ID number is 100000.

targets Yes Target String The value is in the standard CSV -


vertex format. IDs are separated by
ID set commas (,), for example, Alice,
Nana.
The maximum ID number is 100000.

directed No Whet Boole true or false false


her to an
consid
er the
edge
directi
on

timeWin No Time Objec For details, see Table 5-463. -


dow windo t
w
used
for
time
filterin
g

Table 5-463 timeWindow parameter description


Parame Mand Description Typ Value Range Def
ter atory e ault
Valu
e

filterNa No Name of the time Stri Character string: The -


me property used for ng property on the
time filtering corresponding vertex/
edge is used as the time.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 538
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parame Mand Description Typ Value Range Def


ter atory e ault
Valu
e

filterTy No Filtering by vertex or Stri V: filtering by vertex BOT


pe edge ng E: filtering by edge H
BOTH: filtering by vertex
and edge

startTi No Start time Stri Date character string or -


me ng timestamp

endTim No End time Stri Date character string or -


e ng timestamp

Table 5-464 response_data parameter description


Parameter Type Description

path List Shortest path. The format is as follows:


[vertexId,...]
where
vertexId is of the string type.

source String Source vertex ID

target String Target vertex ID

5.2.9.2.4 Common Neighbors of Vertex Sets

Table 5-465 Parameter description


Parameter Mand Descripti Type Value Range Default
atory on Value

sources Yes Source String The value is in the -


(2.2.6) vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Alice, Nana.
The maximum ID
number is 100000.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 539
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mand Descripti Type Value Range Default


atory on Value

targets Yes Target String The value is in the -


(2.2.6) vertex ID standard CSV format.
set IDs are separated by
commas (,), for
example, Mike,Amy.
The maximum ID
number is 100000.

restricted No Whether Boolea true or false true


(2.2.13) other n ● false: There is no
constraint additional constraint.
s are The found common
included neighbors are the
intersection of the
neighborhoods
corresponding to the
source vertex set
and target vertex
set.
● true: There are
additional
constraints. The
found common
neighbors are not
only the intersection
of the
neighborhoods
corresponding to the
source vertex set
and target vertex
set, but each vertex
in the common
neighbor set has at
least two
neighboring vertices
in the source vertex
set and target vertex
set.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 540
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-466 response_data parameter description


Parameter Type Description

vertices List Common neighbor vertices. The format


is as follows:
[vertexId,...],
where
vertexId is of the string type.

common_neigh Integer Number of common neighbors


bors

5.2.10 Graph Statistics APIs

5.2.10.1 Querying General Information About a Graph

Function
This API is used to query the general information about a graph, such as the
numbers of vertices and edges.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/summary?
label_details={labelDetails}

Table 5-467 URI parameters


Paramet Mand Type Description
er atory

project_id Yes String Project ID. For details about how to obtain the
project ID, see Obtaining a Project ID.

graph_na Yes String Graph name


me

labelDeta No Boolea Whether to return the number of vertices and


ils n edges under each label. The default value is
false. If this parameter is set to true, the
numbers of vertices and edges under each label
are returned.

Example Request
Query general information about a graph, such as the numbers of vertices and
edges. The value true indicates that the numbers of vertices and edges of
different labels are returned.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 541
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/summary?label_details=true

NOTE

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

Response Parameters

Table 5-468 Response body parameters

Parameter Type Description

errorMessag String System prompt.


e ● 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.


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

jobId String ID of an asynchronous job


You can view the job execution status and obtain
the return result by querying the job ID. For details,
see Querying Job Status on the Service Plane.

Example Response
Status code: 200

Example response for a successful request


Http Status Code: 200
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorMessage": "graph [demo] is not found",
"errorCode": "GES.8001"
}

Status Codes
Return Value Description

400 Bad Request Request error.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 542
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Return Value Description

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.

5.2.10.2 Querying the Graph Version

Function
This API is used to query the graph version.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/version

Table 5-469 URI parameters


Parameter Mandat Type Description
ory

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
None

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 543
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-470 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.


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

version String Query results. This parameter is left blank when


the request fails.

Example Request
Query the graph version.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/version

NOTE

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

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"version":"2.0.0"
}

Status code: 400

Example response (failed request)


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 544
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

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.

5.2.11 Graph Operation APIs

5.2.11.1 Importing a Graph

Function
This API is used to import graph data.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-graph

Table 5-471 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_nam Yes String Graph name


e

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 545
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-472 Request body parameters


Parameter Mandatory Type Description

edgesetPath No String Edge file directory or name

edgesetForm No String Format of the edge data set.


at Currently, only the CSV format is
supported.
The CSV format is used by
default.

vertexsetPath No String Vertex file directory or name

vertexsetFor No String Format of the vertex data set.


mat Currently, only the CSV format is
supported.
The CSV format is used by
default.

schemaPath No String OBS path of the metadata file of


the new data

logDir No String Directory for storing logs of


imported graphs. This directory
stores the data that fails to be
imported during graph creation
and detailed error causes.

parallelEdge No Object Repetitive edge processing

action No String Way of processing repetitive


edges. If the value of action is
override, the previous repetitive
edges are overwritten. If the value
of action is ignore, repetitive
edges are ignored. This means if
an edge already exists, the edge
will be ignored and will not be
overwritten.

ignoreLabel No Boolean Whether to ignore labels on


repetitive edges. The value is
false.
false: Indicates that the repetitive
edge definition contains the label.
That is, the <source vertex, target
vertex, label> indicates an edge.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 546
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

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.

offline No Boolean Whether to import a graph


offline. The value is false.
false: Online import is selected.
Compared with offline import,
online import is slower. However,
the graph can be read (cannot be
written) during the import.

obsParameter Yes Object OBS parameters


s

Table 5-473 parallelEdge parameter type


Parameter Mandatory Type Description

sortKeyColumn No Int/String Index of the sort key column in


the edge file. The value starts
from 1. If this parameter is set
to last Column, the sort key
column is the last column.
The options are as follows:
● A positive integer
● A positive integer of the
string type
● "lastColumn"

sortKeyType No String Type of the sortKey value. The


options are int and string.

Table 5-474 obsParameters parameters


Parameter Mandatory Type Description

accessKey Yes String User AK

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 547
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

secretKey Yes String User SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Response Parameters

Table 5-475 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.


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

jobId String ID of an asynchronous job


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

Example Request
Import a graph. The edge file directory is testbucket/demo_movie/edges/ and
the edge data set format is CSV; the vertex file directory is testbucket/
demo_movie/vertices/ and the vertex data set format is CSV; the OBS path of the
metadata file of the new data is testbucket/demo_movie/
incremental_data_schema.xml and the log storage directory is testbucket/
importlogdir.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-graph
{
"edgesetPath": "testbucket/demo_movie/edges/",
"edgesetFormat": "csv",
"vertexsetPath": "testbucket/demo_movie/vertices/",
"vertexsetFormat": "csv",
"schemaPath": "testbucket/demo_movie/incremental_data_schema.xml",
"logDir": "testbucket/importlogdir",
"parallelEdge": {
"action":"override",
"ignoreLabel":true

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 548
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

},
"delimiter": ",",
"trimQuote": "\"",
"offline": true,
"obsParameters": {
"accessKey": "xxxxxx",
"secretKey": "xxxxxx"
}

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorCode": "GES.8013",
"errorMessage": "graph [movie2] is not found"
}

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.

5.2.11.2 Clearing a Graph

Function
This API is used to clear graph data.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 549
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=clear-graph

Table 5-476 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_nam Yes String Graph name


e

Request Parameters

Table 5-477 Request body parameter

Parameter Mandatory Type Description

clearMetad No Boolean Whether to clear schema data.


ata The default value is false.

Response Parameters

Table 5-478 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.


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

jobId String ID of an asynchronous job


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 550
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
Clear a graph by deleting its schema data.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=clear-graph
{
"clearMetadata": true
}

Example Response
Status code: 200

Example response (successful request)


Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Example response (failed request)


Http Status Code: 400
{
"errorCode": "GES.8012",
"errorMessage": "graph [movie2] is not found"
}

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.

5.2.11.3 Exporting a Graph

Function
This API is used to export graph data.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 551
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

If you choose to export CSV files to your local host, the files are opened using the
spreadsheet software by default. You are advised to open the files in a text editor. If the
data contains special characters such as plus signs (+), minus signs (-), equal signs (=), and
at signs (@), the data will be parsed into formulas by the software. To ensure system
security, pay attention to the following when opening such files:
1. Do not select Enable Dynamic Data Exchange Server Launch (not recommended).
2. Do not select Enable or Yes if a dialog box indicating a security issue is displayed.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=export-graph

Table 5-479 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_nam Yes String Graph name


e

Request Parameters

Table 5-480 Request body parameters

Parameter Mandatory Type Description

graphExpor Yes String OBS path a graph is exported to


tPath

edgeSetNa Yes String Name of the exported edge data


me set

vertexSetNa Yes String Name of the exported vertex data


me set

schemaNa Yes String Name of the exported metadata


me file

paginate No Object Pagination parameters. For details,


see paginate parameter
description.

obsParamet Yes String OBS parameters. For details, see


ers obsParameters parameter
description.

accessKey Yes String User AK

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 552
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Mandatory Type Description

secretKey Yes String User SK

Table 5-481 paginate parameter description


Parameter Mandatory Type Description

rowCountP No Integer Maximum number of rows in each


erFile file when graphs are exported by
page. The default value is
1000000.

numThread No Integer Number of concurrent threads


when graphs are exported by
page. The default value is 8. The
maximum value cannot exceed
the number of kernels.

maxSizePer No Integer Maximum size of each file when


File graphs are exported by page, in
bytes. By default, the size cannot
exceed the maximum size of the
file that was imported.

Table 5-482 obsParameters parameter description


Parameter Mandatory Type Description

accessKey Yes string AK

secretKey Yes string SK

NOTE

obsParameters, accessKey, and secretKey are mandatory in OBS scenarios and optional in
HDFS scenarios.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 553
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Response Parameters

Table 5-483 Response body parameters

Parameter Mandator Description


y

errorMessa No System prompt


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

errorCode No System prompt code


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

jobId No ID of an asynchronous job


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

Example Request
Export a graph. The OBS path for exporting the graph is demo_movie/, the name
of the exported edge data set is set_edge, the name of the exported vertex data
set is set_vertex, and the name of the exported metadata file is set_schema.xml.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=export-graph
{
"graphExportPath": "demo_movie/",
"edgeSetName": "set_edge",
"vertexSetName": "set_vertex",
"schemaName": "set_schema.xml",
"paginate":{
"numThread":8,
"rowCountPerFile":1000000
},
"obsParameters": {
"accessKey": "xxxxxx",
"secretKey": "xxxxxx"
}
}

Example request 2
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=export-graph
{
"graphExportPath": "demo_movie/",
"edgeSetName": "set_edge",
"vertexSetName": "set_vertex",
"schemaName": "set_schema.xml",
"obsParameters": {
"accessKey": "xxxxxx",
"secretKey": "xxxxxx"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 554
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

}
}

Example Response
Status code: 200

Example response for a successful request


Http Status Code: 200
{
"jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorCode": "GES.8301",
"errorMessage": "Graph [10001-movie] does not exist, please check projectId and graphName."
}

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 for Service Plane APIs.

5.2.11.4 Creating a Graph

Function
This API is used to create a graph.

URI
POST /ges/v1.0/{project_id}/graphs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 555
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-484 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.

Request Parameters

Table 5-485 Request body parameters

Parameter Mandatory Type Description

graphName Yes String Graph name. The value can


contain 4 to 32 characters and
must start with a letter. Only
letters, digits, and underscores (_)
are allowed.

idType Yes String ID type. The value can be hash or


fixedLengthString.

idLength No Integer This parameter is mandatory if


id_type is fixedLengthString. The
value ranges from 1 to 128.

Response Parameters

Table 5-486 Response body parameters

Parameter Type Description

errorMessa String System prompt


ge ● 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 code


● 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 Query result. The value is success for a


successful query and failed for a failed query.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 556
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example Request
POST /ges/v1.0/{project_id}/graphs
{
"graphName": "xxx",
"idType": "fixedLengthString",
"idLength": 20
}

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": "graph [movie] already exists",
"errorCode": "GES.8012",
"result": "failed"
}

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 for Service Plane APIs.

5.2.11.5 Deleting a Graph

Function
This API is used to delete a graph.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 557
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

URI
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}

Table 5-487 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_nam Yes String Graph name


e

Request Parameters
None

Response Parameters

Table 5-488 Response body parameters

Parameter Type Description

errorMessa String System prompt


ge ● 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 code


● 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


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

Example Request
DELETE /ges/v1.0/{project_id}/graphs/{graph_name}

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 558
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Example response for a successful request


Http Status Code: 200
{
"jobId": "3-f78ec641-ed66-4983-bf93-7f9b3a716c780000000019090"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorMessage": "Graph [10001-movie1006] does not exist, please check project_id and graph_name.",
"errorCode": "GES.8301"
}

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 for Service Plane APIs.

5.2.11.6 Listing Graphs

Function
This API is used to list graphs.

URI
GET /ges/v1.0/{project_id}/graphs

Table 5-489 URI parameter

Parameter Mandatory Type Description

project_id Yes String Project ID. For details about how


to obtain the project ID, see
Obtaining a Project ID.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 559
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters
None

Response Parameters

Table 5-490 Response body parameters


Parameter Mandatory Description

graphs Array of Returned graph list


graphs
objects

result String Query result. The value is success for a


successful query and failed for a failed query.

Table 5-491 graphs


Parameter Mandatory Description

graphName String Graph name

idType String ID type

idLength Integer ID length

averageImportR Integer Average import rate


ate

Example Request
GET /ges/v1.0/{project_id}/graphs

Example Response
Status code: 200
Example response for a successful request
Http Status Code: 200
{
"graphs": [
{
"graphName": "movieee",
"idType": "fixedLengthString",
"idLength": 20,
"averageImportRate": 0.0
},
{
"graphName": "ldbc",
"idType": "fixedLengthString",
"idLength": 20,
"averageImportRate": 0.0
}
],

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 560
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"result": "success"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"result": "failed"
}

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 for Service Plane APIs.

5.2.12 Job Management APIs

5.2.12.1 Querying the Job List

Function
After the ID of an asynchronous job is returned, if the job ID at the service layer is
lost and cannot be obtained through the API, a new API is provided to query all
asynchronous jobs stored in the engine. The job ID, job status, and original request
of each job are returned.

NOTE

A maximum of 100 thousand records can be returned for database edition graphs.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/status?
limit={limit}&offset={offset}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 561
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-492 URI parameters

Parame Mandat Type Description


ter ory

project_i Yes String Project ID. For details about how to obtain the
d project ID, see Obtaining a Project ID.

job_id Yes String ID of the job corresponding to the response

Request Parameters
For details, see the URI parameters.

Response Parameters

Table 5-493 Response body parameters

Parameter Type Description

errorMessa String System prompt.


ge ● 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.


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

result String Query result. If the query is successful, the


value is success. If the query fails, the value is
failed.

jobs Object Job status list stored in the system. If execution


succeeds, this parameter is contained in the
response. Table 5-494 describes the structure
of a single jobs field.

Table 5-494 Job status structure

Parameter Type Description

jobId String Job name.

request Object Request content, including the command, URL,


and body.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 562
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

status String Job status. The value can be pending, running,


or complete.

Example Request
Query the job list and return the job ID and status of each job.
GET /ges/v1.0/{project_id}/graphs/movie/jobs/status

Example Response
Status code: 200
Example response for a successful request
Http Status Code: 200
{
"jobs": [
{
"jobId": "62582163123991943683d0f9aa3-f701-48be-a662-360e6a0455da",
"status": "complete",
"request": {
"command": "import_graph",
"url": "/ges/v1.0/10001/graphs/moviejx/action?action_id=import-graph",
"body": {
"edgesetPath": "file:///root/ges-install/auDatas/ranking_edge-sp.csv",
"vertexsetPath": "file:///root/ges-install/auDatas/movies_vertex_new.csv",
"schemaPath": "file:///root/ges-install/auDatas/schema_aikv.xml.bak"
}
}
},
{
"jobId": "62582163123991943683fe74caf-f4d3-48b3-b3ee-66daaedcd2ca",
"status": "complete",
"request": {
"command": "import_graph",
"url": "/ges/v1.0/10001/graphs/moviejx/action?action_id=import-graph",
"body": {
"edgesetPath": "file:///root/ges-install/auDatas/ranking_edge-sp.csv",
"vertexsetPath": "file:///root/ges-install/auDatas/movies_vertex_new.csv",
"schemaPath": "file:///root/ges-install/auDatas/schema_aikv.xml.bak"
}
}
},
{
"jobId": "6258216312399194368daa80df3-e3bd-440d-9764-74f4622a550f",
"status": "complete",
"request": {
"command": "import_graph",
"url": "/ges/v1.0/10001/graphs/moviejx/action?action_id=import-graph",
"body": {
"edgesetPath": "file:///root/ges-install/auDatas/ranking_edge-sp.csv",
"vertexsetPath": "file:///root/ges-install/auDatas/movies_vertex_new.csv",
"schemaPath": "file:///root/ges-install/auDatas/schema_aikv.xml.bak"
}
}
},
{
"jobId": "62582163123991943680ed2761f-01f7-4fbf-b867-0a9aae6d9c12",
"status": "complete",
"request": {
"command": "import_graph",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 563
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

"url": "/ges/v1.0/10001/graphs/moviejx/action?action_id=import-graph",
"body": {
"edgesetPath": "file:///root/ges-install/auDatas/ranking_edge-sp.csv",
"vertexsetPath": "file:///root/ges-install/auDatas/movies_vertex_new.csv",
"schemaPath": "file:///root/ges-install/auDatas/schema_aikv.xml.bak"
}
}
}
],
"result": "success"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorMessage": "graph : movidde not exist",
"errorCode": "GES.8000",
"result": "failed"
}

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.

5.2.12.2 Querying Job Status

Function
This API is used to query the execution status of a job. After asynchronous APIs
such as those for querying vertices and edges or executing algorithms are used,
job IDs are returned. You can use the job ID to query the execution status of each
job.

URI
GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/status?
offset=offset&limit=limit

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 564
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-495 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.

job_id Yes String Job ID

offset No Integer Offset of a query. The default value is 0.

limit No Integer Maximum number of records that can be


queried. The default value is 100000.

Response Parameters

Table 5-496 Response body parameters


Parameter Type Description

errorMessag String System prompt.


e ● 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.


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

status String Returned job status after the query is


successful. Possible values:
● pending
● running
● success
● failed
This parameter is left blank when the query
fails.

data Object Algorithm execution result. This parameter is


left blank when the query fails.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 565
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-497 data parameter description


Parameter Type Description

vertices List Vertex-associated algorithm result

edges List Edge-associated algorithm result

outputs Object Other results

data_return_ Integer Number of records returned after a query


size

data_offset Integer Result offset of a query

data_total_si Integer Total amount of result data generated by


ze asynchronous jobs

Example Request
Query the execution status of a job. The query offset is 0, and the maximum
number of returned results is 2.
GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/status?offset=0&limit=2

NOTE

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
{
"data": {
"outputs": {
"data_return_size": 2,
"vertices": [
{
"id": "Sarah",
"label": "user",
"properties": {
"Occupation": [
"other or not specified"
],
"Name": [
"Sarah"
],
"Zip-code": [
"55105"
],
"Gender": [
"F"
],
"Age": [
"18-24"
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 566
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

},
{
"id": "Sidney",
"label": "user",
"properties": {
"Occupation": [
"writer"
],
"Name": [
"Sidney"
],
"Zip-code": [
"85296"
],
"Gender": [
"M"
],
"Age": [
"18-24"
]
}
}
],
"data_offset": 0,
"data_total_size": 19
}
},
"status": "success"
}

Status code: 400

Example response for a failed request


Http Status Code: 400
{
"errorMessage":"graph [demo] is not found",
"errorCode":"GES.8402"
}

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.

5.2.13 Cypher Operation APIs

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 567
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.13.1 Executing Cypher Queries

Function
Cypher is a widely used declarative graph database query language. It can be used
to query data in GES and returns results. Graph statistics are used in Cypher
implementation. Currently, the label-based vertex and edge indexes are used
during Cypher query and compilation. To use Cypher normally, create indexes by
referring to Cypher Prerequisites.

URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
cypher-query

Table 5-498 URI parameters


Parameter Mandat Type Description
ory

project_id Yes String Project ID. For details about how to


obtain the project ID, see Obtaining a
Project ID.

graph_na Yes String Graph name


me

Example Request
Execute a Cypher query. The Cypher statement is match (n) return n limit 1. The
returned results are in the format that each element corresponds to a field in the
row.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-cypher-
query
{
"statements": [{
"statement": "match (n) return n limit 1",
"parameters": {},
"resultDataContents": ["row"],
"includeStats": false
}]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 568
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Request Parameters

Table 5-499 Request body parameter


Parameter Manda Type Description
tory

statements Yes List Statement group that contains one


or more statements. The
statements parameters table
describes the format of each
element.

Table 5-500 statements parameters


Parameter Manda Type Description
tory

statement Yes String Cypher statement

parameters Yes Object Cypher statement parameters, which


are used for parameterized queries. By
default, this field is left blank.
For details, see parameterized
queries.

resultDataContent No String or Format of the returned result. You can


s List set one or more formats. Available
values are row, graph, and raw
(added in version 2.2.27).

includeStats No Boolean Whether the returned result contains


addition, deletion, and modification
statistics. If this parameter is not set,
the returned result does not contain
the information by default.

runtime No String Executor type. The value can be map


or slotted. The default value is map.
The slotted executor is supported
since version 2.3.15.

executionMode No String Execution mode. Set this parameter to


(2.2.23) sync for synchronous execution and
to async for asynchronous execution.
If this parameter is not set, the
execution is synchronous by default.
For details about how to obtain the
query result in asynchronous mode,
see Querying Job Status on the
Service Plane.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 569
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Manda Type Description


tory

limit (2.2.23) No Int Maximum number of results of the


asynchronous query. This parameter is
valid only when executionMode is
sync. The default value is 100000.

transactional No Bool Whether the Cypher request is


transactional. The default value is
false. For details about Cypher
transactions, see Cypher
transactions.

NOTE

● You can add the explain or profile prefix before a statement to display the query plan.
The explain prefix displays only the query plan but does not execute the statement. The
profile prefix displays the query plan and executes the statement.
● Description of the runtime field: Compared with the map executor, the slotted executor
completes more statement data flow analysis in the plan generation phase of
statements. In most cases, it executes faster while requiring less memory.
● In asynchronous mode (executionMode is async), cypher query results can be exported
to CSV files (GES 2.3.4 or later supports this function). For details, see Exporting Job
Execution Results to Files. Currently, the following values can be returned:
1. Vertex and edge single-value properties, vertex and edge IDs, and group counts.
2. The current version does not support exporting object types. Objects are converted
to null values in the CSV file.
● Cypher transactions (database edition only):
1. For database edition graphs, Cypher transactions are supported. You can set
transactional to true to enable the function to ensure the atomicity of a single
Cypher statement. Transactions supporting multiple Cypher statements are not
available. Transactions in GES use a serializability isolation level.
2. The transaction time window is limited to 5s in the underlying storage engine of
GES. Cypher transactions cannot last exceeding 5s. For complex queries, such as
multi-hop queries, the running time may exceed 5s. The transaction times out and
the submission fails.
In this case, you can use the dbms.killQuery program of Cypher to terminate a
Cypher transaction (for details, see Cypher API-Functions and Procedures) and
restore all changes caused by the Cypher request.

Response Parameters

Table 5-501 Response body parameters

Parameter Type Description

results List Each element of the list is the return result of a


Cypher statement.

errors List Each element in the list contains the code and
message information in string form.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 570
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-502 Elements of the results parameter


Parameter Type Description

columns List Name of a returned field

data List Returned data value. Each element indicates a


record.

stats Object Addition, deletion, and modification statistics

plan Object If the Cypher statement contains the explain or


profile prefix, this field contains the query plan.
Otherwise, this field is not displayed. The profile
feature is supported since version 2.3.12.

jobId(2.3.10) String Asynchronous job ID if the request is executed


asynchronously

jobType(2.3.1 Integer Type of the asynchronous job if the request is


0) executed asynchronously

Table 5-503 Elements of the data parameter


Parameter Type Description

row List Content of a specific row. Each element


corresponds to a field in the row. This parameter
is displayed only when resultDataContents is
empty or contains row.

meta List Type of each field in a row. This parameter is


displayed only when resultDataContents is
empty or contains row.

graph Object Information returned in graph format. This


parameter is displayed only when
resultDataContents contains graph.

raw(2.2.27) List Information returned in raw format. This


parameter is displayed only when
resultDataContents contains raw.

Table 5-504 stats elements in a response


Parameter Type Description

contains_upd Boolean Whether data is modified during the query


ates

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 571
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Parameter Type Description

edges_create Integer Number of created edges


d

edges_delete Int Number of deleted edges


d

labels_set Integer Number of labels that have been set

properties_se Integer Number of properties that have been set


t

vertices_creat Integer Number of created vertices


ed

vertices_delet Integer Number of deleted vertices


ed

Example Response
Status code: 200
Example response for a successful request (synchronous call)
Http Status Code: 200
{
"results": [
{
"columns": ["n"],
"data": [
{
"row": [
{
"occupation": "artist",
"gender": "F",
"Zip-code": "98133",
"userid": 0,
"age": "25-34"
}
],
"meta": [
{
"id": "46",
"type": "node",
"labels": [
"user"
]
}
]
}
],
"stats": {
"contains_updates": false,
"edges_created": 0,
"edges_deleted": 0,
"labels_set": 0,
"properties_set": 0,
"vertices_created": 0,
"vertices_deleted": 0
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 572
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

],
"errors": []
}

Status code: 200


Example response for a successful request (asynchronous call)
Http Status Code: 200
{
"results": [
{
"columns": [
"jobId",
"jobType"
],
"jobId": "b64a5846-e306-4f87-b0f1-d595ee2a9910",
"jobType": 1,
"data": [
{
"row": [
"b64a5846-e306-4f87-b0f1-d595ee2a9910",
1
],
"meta": [
null,
null
]
}
]
}
],
"errors": []
}

Status code: 400


Example response (failed request)
Http Status Code: 400
{
"results": [],
"errors": [
{
"code": "GES.8904",
"message": "Label index in vertices is not found."
}
]
}

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 573
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Error Codes
See Error Codes.

5.2.13.2 Basic Operations and Compatibility

Basic Operations
Operation Cypher Statement

Querying vertices match (n) return n

Querying edges match (n)-[r]->(m) return n, r, m

Querying paths match (n:user)-[r]->(m:movie)-->(s:series) return n,r,m,s

Querying vertices match(n:user) where n.userid>=5 return n


based on filter
criteria

Grouping and match(n:movie) return n.genres, count(*)


aggregating

Deduplicating match(n:movie) return distinct n.genres

Sorting match(n:movie) return n order by n.movieid

Creating a vertex create (n:user{userid:1}) return n

Creating an edge match (n:user{userid:15}),(m:movie{movieid:10}) create


(n)-[r:rate]->(m)

Deleting a vertex match (n:user{userid:1}) delete n

Modifying labels match (n:user{userid:1}) set n:movie return n

Modifying properties match (n:user{userid:1}) set n.userid=2 return n

Compatibility to Cypher
1. Cypher clauses
Cypher implements a couple of clauses. You can combine clauses to
implement different query semantics, including vertex and edge filtering,
multi-hop query, sorting and deduplication, and grouping and aggregation.
Currently, GES supports the Cypher clauses listed in the following table.

Table 5-505 Supported Cypher clauses

Clause Support Example

match Partially match (n:movie) return n


supported

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 574
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Clause Support Example

optional Partially optional match (n)-->(m) where id(n)='1'


match supported return m

return Supported return [1,2,3] as p

with Supported match (n) with labels(n) as label, count(*) as


count
where count > 10 return *

where Supported match (n:movie) where n.movieid > 10 return


n

order by Supported match (n:movie) return n order by n.genres

skip Supported match (n:movie) return n order by n.genres


skip 5

limit Supported match (n:movie) return n order by n.genres


skip 5 limit 10

create Supported create (n:user{_ID_: 'Jack' }) return n

delete Supported match (n:movie)<-[r]-(m:user) delete r

set Supported match (n:user{userid:0}) set n.gender='M'


return n

call Supported call db.schema()


procedures

unwind Supported unwind [1, 2, 3] as p return p

union Supported match (n:movie) return id(n) union match


(n:user) return id(n)
NOTE
Union is available for graphs smaller than 10 billion
edges only.

NOTE

1. Currently, merge and foreach operations are not supported. Cypher statements
cannot add or delete indexes.
2. GES metadata is not schema-free, and the vertex and edge label properties are
strictly restricted. Therefore, the remove operation is not supported.
3. The order by clause does not support sorting of the list type. When Cardinality of
the property value is not single, the sorting result is unknown.
– Available items for the match clause

Item Description Example Clauses Earliest


Version
Require
d

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 575
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Vertex Patterns for match 2.2.16


pattern matching vertex (n:movie{title:'hello'})
with specified match (n) where
labels, properties, id(n)='xx'
and IDs.

Edge Patterns for match (n)-[r] -> (m) 2.2.16


pattern matching match (n)-[r]- (m)
directional and
non-directional match (n)-
edges with [r:rate{Rating:1}] - (m)
specified labels match (n)-[r]- (m) where
and properties. id(n)='x'and id(m)='y'
Specified IDs of
both start and
end vertices are
supported.

Path Anonymous paths match (n)-[r]->(m)-->(s) 2.2.16

Named paths match p=(n)-[r]->(m)-- 2.2.19


>(s)

Multiple You can enter multiple patterns after match 2.2.16


patterns and separate them with commas (,).
match (n)-[r]->(m), (m)-->(s)

Multi- You can enter multiple match clauses. You can 2.2.16
match use with to connect multiple clauses.
match (n)-[r]->(m) with m match (m)-->(s)

Variable- Patterns for matching variable-length paths 2.2.19


length starting with a specified vertex.
path match p=(n)-[r*1..3]->(m) where
pattern id(n)='xx'return p
match p=(n{title:'name'})-[r*1..3]->(m) return
p

Traversal conditions for matching variable- 2.2.28


length paths.
match p=(n)-[r*1..3]->(m) where id(n)='xx'and
all (x in nodes(p) where x.prop='value1') return
p

Both start vertex and end vertex of a variable- 2.3.9


length path can be specified.
match p=(n)-[r*1..3]->(m) where id(n)='xx'
and id(m)='y' return p

Deduplication by end vertex is not supported: No


match p=(n)-[r*1..3]->(m) where id(n)='xx'
and id(m)='yy'return distinct m

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 576
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

2. Parameterized queries
Cypher supports parameterized queries. Numeric and string values in a query
statement are extracted and converted to parameters for faster compilation,
improving the query speed.
There are some examples of parameterized queries:
– Example 1
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?
action_id=execute-cypher-query
{
"statements": [{
"statement": " match (n:user) where n.occupation = $occupation return n",
"parameters": {
"occupation" : "artist"
},
"resultDataContents": ["row"]
}]
}

– Example 2
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?
action_id=execute-cypher-query
{
"statements": [{
"statement": " match (n:user {`Zip-code`:'98133'}) set n = $props return n",
"parameters": {
"props": {
"gender": "M",
"age": "56+"
}
},
"resultDataContents": ["row"]
}]
}

NOTE

There are some scenarios where parameterized queries are not supported. The
following syntax is not valid:
1. Using $param to search by property key and value. For example, match (n) where
n.$param = 'something'
2. Using $code for vertex and edge labels. For example, match (n:user) set n:$code
3. Supported data types
Currently, GES supports 10 data types: char, char_array, float, double, Boolean,
long, Integer, date, enum, and string. Both Boolean and numeric types are
supported in the Cypher syntax. The following table lists the mapping
between other types and Cypher data types.

Table 5-506 Mapping between data types of GES and Cypher

GES Cypher Description

char String -

char_arra String -
y

string String -

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 577
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

GES Cypher Description

date Temporal Currently, Cypher dates can be converted into


GES dates, but Cypher date functions cannot
be used for inputting a date.

Table 5-507 Special types supported by Cypher


Type Supported Example

Node Yes match (n) return n limit 10

Relations Yes match (n)-[r]->(m) return r limit 10


hip

List Yes return [1,2,3] as li

Map Yes match (n)-->(m) return {start:id(n), end:id(m)}

Path Yes match p=(n1)-[:friends*1..2]-(n2) return p limit


10

Point, No -
Spatial

NOTE

For the special types listed above, only the List type can be used to match multi-value
properties in GES. Other types cannot be used in a set statement for setting the value
of a property.
4. Vertex ID compatibility
– Cypher does not provide the syntax for setting the ID when a vertex is
added. In GES, however, an ID of the string type is required to uniquely
identify a vertex. To use the Cypher syntax in GES, add _ID_ to specify the
ID of a vertex in the create statement. For example, the
create(n{_ID_:'123456'}) statement creates a vertex whose ID is 123456.
– If the ID is not specified, a random ID is generated for the vertex.
NOTE

The _ID_ identifier is supported only in the create statement. The match and set
clauses do not support the _ID_ identifier. In the match clause, you can use the
id() function to obtain the vertex ID.
– Creating a multi-label vertex
GES graphs of the database edition supports the creation of vertices with
multiple labels by running Cypher statements, for example, create
(n:user:student {userid:10, studentName:'Bob'}).
The attributes of all labels are enclosed in a single set of curly braces. The
creation process automatically matches labels with their corresponding
attributes based on the schema, and the order of the attributes has no
impact on their correspondence with the labels.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 578
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

5.2.13.3 Supported Expressions, Functions, and Procedures

Expression
Cypher queries support multiple expressions and can be used in combination to
form various filter criteria. Currently, the following expressions are supported:

Operation Type Expression Example

Logical and match (n:user) where n.age='Under 18' and


operations n.gender='F' return n

or match(n:user) where n.`Zip-code`='22181' or


n.userid=6 return n

not match(n:movie) where not n.genres contains


'Drama' return n

Null value is null match (n) where n.userid is null return n


judgment
is not null match (n) where n.userid is not null return n

Comparison >,>=,<,<=,=, match(n:user) where n.userid>=5 return n


calculation <>

Arithmetic +,-,*,/,%,^ return (1+3)%3


operations

String starts with match(n:movie) where n.genres starts with


comparisons 'Comedy' return n

ends with match(n:movie) where n.genres ends with


'Drama' return n

contains match(n:movie) where n.genres contains


'Drama' return n

List-related in match(n:student) where 'math' in n.courses


operation return n

[] match(n:user) return n[' userid']


with [1, 2, 3, 4] as list return list[0]
with [1, 2, 3, 4] as list return list[0..1]
match p=(n)-->(m) return [x in nodes(p)
where x.gender='F'|id(x)]

Date expressions .year, .mont Year, month, and day of a specific date: with
h, .day, .hou '2000-12-27 23:44:41' as strVal with
r, .minute, .s datetime(strVal) as d2 return d2.year,
econd, .day d2.month, d2.day, d2.hour, d2.minute,
OfWeek d2.second,d2.dayOfWeek, d2.ordinalDay

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 579
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

The where clause in Cypher queries does not support regular expressions.

Function
Cypher supports the following functions for grouping, aggregation, and vertex and
edge operations:

1. Aggregate

Function Earliest Description Example


Version
Supporte
d

count 2.2.17 Returns the match (n) return count(*)


total number of match (n) return
results. count(n.userid)

collect 2.2.17 Collects results match (n:movie) return


into a list. n.genres, collect(n) as
movieList

sum 2.3.3 Returns the sum unwind [1, 2.0, 3] as p return


of values. sum(p)

avg 2.3.3 Returns the unwind [1, 2.0, 3] as p return


average of avg(p)
values.

min 2.3.3 Returns the unwind [1, 2.0, 3] as p return


minimum value. min(p)

max 2.3.3 Returns the unwind [1, 2.0, 3] as p return


maximum value. max(p)

2. Regular functions
Based on the types of input parameters, regular functions are classified into
vertex and edge functions, path functions, list functions, and value functions.

Table 5-508 Vertex and edge functions

Function Earliest Description Example


Version
Supporte
d

id 2.2.16 Obtains the ID match (n) return id(n)


of a vertex.

labels 2.2.16 Obtains labels match (n) return labels(n)


of a vertex.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 580
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supporte
d

type 2.2.16 Obtains the match(n)-[r]->(m) return


label of an type(r)
edge.

degree 2.2.26 Obtains the match (n) where id='Vivian'


degree of a return degree(n)
vertex.

inDegree 2.2.26 Obtains the match (n) where id='Vivian'


indegree of a return inDegree(n)
vertex.

outDegree 2.2.26 Obtains the match (n) where id='Vivian'


outdegree of a return outDegree(n)
vertex.

startNode 2.3.10 Obtains the match (n)-[r]->(m) return


start vertex of startNode(r)
an edge.

endNode 2.3.10 Obtains the match (n)-[r]->(m) return


end vertex of endNode(r)
an edge.

Table 5-509 Path functions (2.2.19)


Function Earliest Description Example
Version
Supporte
d

length 2.2.19 Obtains the match p=(n)-[:friends*1..2]-


path length. >(m) return length(p)

Table 5-510 List functions


Function Earliest Description Example
Version
Supporte
d

head 2.3.10 Obtains the with [1,2,3,4] as list return


first element of head(list)
a list.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 581
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supporte
d

last 2.3.10 Obtains the with [1,2,3,4] as list return


last element of last(list)
a list.

size 2.3.10 Obtains the list with [1,2,3,4] as list return


length. size(list)

range(2.3.10 2.3.10 Generates a return range(1,5),


) list. range(1,5,2)

Table 5-511 Value functions


Function Earliest Description Example
Version
Supported

toString 2.2.21 Converts a match (n) where


value to a toString(labels(n)) contains
string. 'movi' return n

toUpper 2.2.26 Converts a match (n:movie) return


string into toUpper(n.title)
uppercase
letters.

toLower 2.2.26 Converts a match (n:movie) return


string into toLower(n.title)
lowercase
letters.

toInteger 2.2.29 Converts a with '123' as p return


string to an int toInteger(p)
number.

toLong 2.2.29 Converts a with '123' as p return


string to a toLong(p)
long number.

toFloat 2.2.29 Converts a with '123.4' as p return


string to a toFloat(p)
float number.

toDouble 2.2.29 Converts a with '123.4' as p return


string to a toDouble(p)
double
number.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 582
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

toBoolean 2.2.29 Converts a with 'true' as p return


string to a toBoolean(p)
bool value.

size 2.2.29 Obtains the with 'GES' as p return size(p)


string length.

subString 2.3.10 Truncates a return subString('abc', 1),


part of a subString('abcde', 1,2)
string.

coalesce 2.3.10 Obtains the return coalesce(null, '123')


first non-null
value of the
parameters.

trim 2.3.11 Removes return trim(' hello ')


whitespace
characters on
both sides of a
string.

lTrim 2.3.11 Removes return lTrim(' hello')


whitespace
characters on
the left side of
a string.

rTrim 2.3.11 Removes return rTrim('hello ')


whitespace
characters on
the right side
of a string.

reverse 2.3.11 Returns a return reverse('hello')


string with the
characters in
reverse order.

left 2.3.11 Obtains with 'hello' as p return left(p,


several 3)
characters
from the left
side of a
string.

right 2.3.11 Obtains with 'hello' as p return right(p,


several 3)
characters
from the right
side of a
string.

replace 2.3.11 Replaces a with 'hello' as p return


string. replace(p, 'll', 'o')

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 583
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

split 2.3.11 Splits a string. with 'hello' as p return split(p,


'e')

Table 5-512 Mathematical functions


Function Earliest Description Example
Version
Supported

floor 2.3.10 Rounds a return floor(4.1)


number down
to the nearest
integer.

ceil 2.3.10 Rounds a return ceil(4.1)


number up to
the nearest
integer.

round 2.3.14 Round return round(3.4), round(3.5)

abs 2.3.14 Absolute value return abs(-3),abs(-3.5)


function

sin 2.3.14 Sine function return sin(pi()/2)

cos 2.3.14 Cosine return cos(0),cos(pi()/2)


function

tan 2.3.14 Tangent return tan(pi()/4)


function

acos 2.3.14 Inverse cosine return acos(1)


function

asin 2.3.14 Inverse sine return asin(0)


function

atan 2.3.14 Inverse return atan(1)


tangent
function

cot 2.3.14 Cotangent return cot(pi()/4)


function

radians 2.3.14 Converts return radians(180)


degree to
radian.

degrees 2.3.14 Converts return degrees(pi())


radian to
degree.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 584
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Function Earliest Description Example


Version
Supported

pi 2.3.14 Returns the return pi()


approximate
value of Pi (π).

Table 5-513 Date and time functions


Function Earliest Description Example
Version
Supported

datetime(v 2.3.10 Returns the return datetime(1688696395)


al) time based on
the timestamp.

datetime() 2.3.14 Obtains the return datetime()


current time
(valid only for
read
statements).

timestamp( 2.3.10 Returns the return


val) timestamp timestamp('2023-07-07
based on the 02:20:42')
time string.

timestamp( 2.3.14 Obtains the return timestamp()


) current
timestamp
(valid only for
read
statements).

localDateti 2.3.14 Converts a return


me time or localDatetime(timestamp())
timestamp to a
local time
string.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 585
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

Table 5-514 Predicate functions


Function Earliest Description Example
Version
Supported

all 2.2.19 If all elements all (x in p where x>1)


meet the
expression,
true is
returned.

any 2.2.19 If any element any (x in p where x>1)


meets the
expression,
true is
returned.

none 2.2.19 If all elements none (x in p where x>1)


cannot meet
the expression,
true is
returned.

single 2.2.19 If only one single (x in p where x>1)


element meets
the expression,
true is
returned.

Table 5-515 Algorithm expressions


Function Earliest Description Example
Version
Supported

shortestPat 2.3.2 Returns the The following statement


h shortest path returns the shortest path
between two between the given vertices n
vertices. and m. The direction is m to n,
and the edge label is rate:
with n,m, shortestPath((n)<-
[:rate*]-(m)) as p return p

allShortest 2.3.2 Returns all The following statement


Paths shortest paths returns all shortest paths
between two between the given vertices n
vertices. and m:
with n,m, allShortestPaths((n)-
[*]-(m)) as p return p

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 586
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

NOTE

● Aggregate functions, such as sum(), avg(), max(), and min(), are not available for
database edition graphs.
● Degree functions, path functions, and algorithm expressions are not available for 10-
billion-edge graphs and database edition graphs. The toUpper and toLower functions
are not available for the database edition.

Procedure
Currently, GES supports the following procedures.

Procedure Statement

Obtaining graph pattern call db.schema()


information

Obtaining vertex labels call db.labels()

Querying the Cypher statements call dbms.listQueries()


that are being executed

Terminating a Cypher statement call dbms.killQuery('queryId')


based on queryId

Querying indexes call db.indexes()

Full-text indexing for querying call db.index.fulltext.queryNodes()


vertices that meet the search
conditions

Full-text indexing for querying call db.index.fulltext.queryRelationships()


edges that meet the conditions

Merging nodes call apoc.refactor.mergeNodes(nodeList,


refactorConfig)

NOTE

● Full-text indexes support six types of queries: prefix, wildcard, regexp, fuzzy, match, and
combine. To use full-text indexes, you need to call the API for creating a full-text index.
● Function and procedure names are case sensitive and must be in lower camel case.
● Example of a full-text index query request
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-
cypher-query
{
"statements": [
{
"statement": "call db.index.fulltext.queryNodes('combine', {title:'1977'}) yield node, score
return node, score skip 1 limit 10",
"resultDataContents": [
"row"
],
"parameters": {}
}
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 587
Graph Engine Service(GES)
API Reference 5 Service Plane APIs

● Parallel edge processing policy


When using Cypher to add edges, you can add duplicate edges. Duplicate
edges are two edges with the same source vertex and target vertex.
● How to add an edge without a label
When you use a Cypher statement to add an edge, set the label of the edge
to the default value __DEFAULT__. For example, create ()-[r:__DEFAULT__]-
>() return r.

Querying the Schema Structure Using Cypher


● Function
You can call the db.schema () function using Cypher to query the structure of
a generated schema (obtained from OBS).
● Query statement
– Name: Schema structure query
– Statement: call db.schema()
– Note:
If you did not call the API for generating the schema structure, the
returned schema file contains all labels.
If you have called the API for generating the schema structure, this API
returns the labels as the vertices and the relationships between the labels
as edges.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 588
Graph Engine Service(GES)
API Reference 6 Application Examples

6 Application Examples

6.1 Analyzing Graphs Using HyG API Algorithms


GES offers a range of fundamental graph algorithms, graph analysis algorithms,
and graph metric algorithms. These algorithms can be used for analyzing
relationships within a graph.

Prerequisites
The HyG computing engine slider was toggled on when creating a graph of the
database edition.

Figure 6-1 HyG computing engine

Procedure
1. Create a HyG graph.
a. Send POST /ges/v1.0/{project_id}/hyg/{graph_name}. project_id indicates
the project ID, and graph_name indicates the name of a graph created in
the graph database.
b. Add X-Auth-Token to the request header.
c. Specify the following parameters in the request body:
{
"inEdge": true // Whether the graph contains the incoming edge
}

d. Check the response. The request is successful if the following response is


displayed:
{
"result": "success"
}

If the request is abnormal, locate the fault by referring to Error Codes for
Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 589
Graph Engine Service(GES)
API Reference 6 Application Examples

2. Synchronize data from the graph database to the HyG computing engine.
a. Send POST /ges/v1.0/{project_id}/hyg/{graph_name}/sync. project_id
indicates the project ID, and graph_name indicates the graph name.
b. Add X-Auth-Token to the request header.
c. Specify the following parameters in the request body:
{
"vertex": [], // Vertex property list

"edge": [
{
"property": [
"Rating"
],
"label": "rate"
}
] // Edge property list
}
d. Check the response. The request is successful if the following response is
displayed:
{
"jobId": "6-57222f3d-f6b8-41ba-b492-60ed9b879223"
}
If the request is abnormal, locate the fault by referring to Error Codes for
Service Plane APIs.
With this API, you can synchronize any changes made to the graph
database, whether it be adding, deleting, or modifying data, to the HyG
computing engine. During the initial data synchronization, the vertex and
edge parameters specified in the request body will be applied. For
subsequent synchronizations, these parameters will default to the values
specified during the first synchronization.
3. Check details about the HyG graph.
a. Send GET /ges/v1.0/{project_id}/hyg/{graph_name}/summary. project_id
indicates the project ID, and graph_name indicates the graph name.
b. Add X-Auth-Token to the request header.
c. Check the response. The request is successful if the following response is
displayed:
{
"data": {
"inEdge": true,
"idIndex": true,
"policy": "oec",
"updateTime": "2024-01-25 10:55:31",
"vertex": [],
"edge": [
{
"label": "rate",
"property": [
"Rating"
]
}
],
"vertexNum": 146,
"edgeNum": 1659
},
"result": "success"
}
If the request is abnormal, locate the fault by referring to Error Codes for
Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 590
Graph Engine Service(GES)
API Reference 6 Application Examples

4. Execute the algorithm.


a. Send POST /ges/v1.0/{project_id}/hyg/{graph_name}/algorithm.
project_id indicates the project ID, and graph_name indicates the graph
name.
b. Add X-Auth-Token to the request header.
c. Specify the following parameters in the request body (using PageRank as
an example):
{
"algorithmName":"pagerank",
"parameters":{
"alpha":0.85,
"convergence":0.00001,
"max_iterations":1000,
"directed":true
}
}

d. Check the response based on the job ID. The request is successful if the
following response is displayed:
{
"status": "complete",
"data": {
"outputs": {
"data_offset": 0,
"data_return_size": 147,
"data_total_size": 147,
"pagerank": [
{
"38": 0.02115960730038959
},
{
"13": 0.018535705068819635
},
{
"7": 0.0166381431701182
},
... ...
],
"runtime": 0.022
}
},
"result": "success"
}

If the request is abnormal, locate the fault by referring to Error Codes for
Service Plane APIs.
5. Delete the HyG graph.
a. Send DELETE /ges/v1.0/{project_id}/hyg/{graph_name}. project_id
indicates the project ID, and graph_name indicates the graph name.
b. Add X-Auth-Token to the request header.
c. Check the response. The request is successful if the following response is
displayed:
{
"jobId": "6-e33ba071-f1ab-4e29-b632-30bd086e40ac"
}

If the request is abnormal, locate the fault by referring to Error Codes for
Service Plane APIs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 591
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

7 Monitoring Metrics

Function
This chapter describes information on the metrics reported by GES, including their
namespaces, lists, and dimensions. You can use the provided APIs to query the
information.

Namespace
SYS.GES

Metrics

Table 7-1 GES metrics

Metric ID Name Description Value Monitored


Range Object

ges001_vertex Vertex Capacity usage of vertices 0 to 100 GES


_util Capacity in a graph instance. The Value instance
Usage value is the ratio of the type:
number of used vertices to Float
the total vertex capacity.
Unit: %

ges002_edge_ Edge Capacity usage of edges in 0 to 100 GES


util Capacity a graph instance. The Value instance
Usage value is the ratio of the type:
number of used edges to Float
the total edge capacity.
Unit: %

ges003_avera Average Average rate of importing 0 to GES


ge_import_rat Import vertices or edges to a 400000 instance
e Rate graph instance Value
Unit: count/s type:
Float

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 592
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Metric ID Name Description Value Monitored


Range Object

ges004_reque Request Number of requests ≥0 GES


st_count Quantity received by a graph Value instance
instance type:
Unit: count Integer

ges005_avera Average Average response time of ≥0 GES


ge_response_t Response requests received by a Value instance
ime Time graph instance type:
Unit: ms Integer

ges006_min_r Minimum Minimum response time of ≥0 GES


esponse_time Response requests received by a Value instance
Time graph instance type:
Unit: ms Integer

ges007_max_r Maximu Maximum response time ≥0 GES


esponse_time m of requests received by a Value instance
Response graph instance type:
Time Unit: ms Integer

ges008_read_t Length of Length of the waiting ≥0 GES


ask_pending_ the queue for read requests Value instance
queue_size Waiting received by a graph type:
Queue instance. This metric is Integer
for Read used to view the number
Tasks of read requests waiting in
the queue.
Unit: count

ges009_read_t Maximu Maximum waiting ≥0 GES


ask_pending_ m duration of read requests Value instance
max_time Waiting received by a graph type:
Duration instance Integer
of Read Unit: ms
Tasks

ges010_pendi Type of Type of the read request ≥1 GES


ng_max_time_ the Read that waits the longest in a Value instance
read_task_typ Task That graph instance. You can type:
e Waits the find the corresponding Integer
Longest task name in GES
documents.

ges011_read_t Length of Length of the running ≥0 GES


ask_running_q the queue for read requests Value instance
ueue_size Running received by a graph type:
Queue instance. This metric is Integer
for Read used to view the number
Tasks of running read requests.
Unit: count

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 593
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Metric ID Name Description Value Monitored


Range Object

ges012_read_t Maximu Maximum running ≥0 GES


ask_running_ m duration of read requests Value instance
max_time Running received by a graph type:
Duration instance Integer
of Read Unit: ms
Tasks

ges013_runni Type of Type of the read request ≥1 GES


ng_max_time_ the Read that runs the longest in a Value instance
read_task_typ Task That graph instance. You can type:
e Runs the find the corresponding Integer
Longest task name in GES
documents.

ges014_write_ Length of Length of the waiting ≥0 GES


task_pending_ the queue for write requests Value instance
queue_size Waiting received by a graph type:
Queue instance. This metric is Integer
for Write used to view the number
Tasks of write requests waiting
in the queue.
Unit: count

ges015_write_ Maximu Maximum waiting ≥0 GES


task_pending_ m duration of write requests Value instance
max_time Waiting received by a graph type:
Duration instance Integer
of Write Unit: ms
Tasks

ges016_pendi Type of Type of the write request ≥1 GES


ng_max_time_ the Write that waits the longest in a Value instance
write_task_typ Task That graph instance. You can type:
e Waits the find the corresponding Integer
Longest task name in GES
documents.

ges017_write_ Length of Length of the running ≥0 GES


task_running_ the queue for write requests Value instance
queue_size Running received by a graph type:
Queue instance. This metric is Integer
for Write used to view the number
Tasks of running write requests.
Unit: count

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 594
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Metric ID Name Description Value Monitored


Range Object

ges018_write_ Maximu Maximum running ≥0 GES


task_running_ m duration of write requests Value instance
max_time Running received by a graph type:
Duration instance Integer
of Write Unit: ms
Tasks

ges019 Type of Type of the write request ≥1 GES


_running_max the Write that runs the longest in a Value instance
_time_ Task That graph instance. You can type:
write_task_typ Runs the find the corresponding Integer
e Longest task name in GES
documents.

ges020_comp Computin Computing resource usage 0 to 100 GES


uter_resource_ g of each graph instance Value instance
usage Resource Unit: % type:
Usage Float

ges021_memo Memory Memory usage of each 0 to 100 GES


ry_usage Usage graph instance Value instance
Unit: % type:
Float

ges022_iops IOPS Number of I/O requests ≥0 GES


processed by each graph Value instance
instance per second type:
Unit: count/s Integer

ges023_bytes_ Network Data input to each graph ≥0 GES


in Input instance per second over Value instance
Throughp the network type:
ut Unit: byte/s Float

ges024_bytes_ Network Data sent to the network ≥0 GES


out Output per second from each Value instance
Throughp graph instance type:
ut Unit: byte/s Float

ges025_disk_u Disk Disk usage of each graph 0 to 100 GES


sage Usage instance Value instance
Unit: % type:
Float

ges026_disk_t Total Disk Total data disk space of ≥0 GES


otal_size Size each graph instance Value instance
Unit: GB type:
Float

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 595
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Metric ID Name Description Value Monitored


Range Object

ges027_disk_u Disk Used data disk space of ≥0 GES


sed_size Space each graph instance Value instance
Used Unit: GB type:
Float

ges028_disk_r Disk Data volume read from ≥0 GES


ead_throughp Read the disk in a graph Value instance
ut Throughp instance per second type:
ut Unit: byte/s Float

ges029_disk_ Disk Data volume written to ≥0 GES


write_through Write the disk in a graph Value instance
put Throughp instance per second type:
ut Unit: byte/s Float

ges030_avg_di Average Average time used each ≥0 GES


sk_sec_per_re Time per time when the disk of a Value instance
ad Disk graph instance reads data type:
Read Unit: second Float

ges031_avg_di Average Average time used each ≥0 GES


sk_sec_per_wr Time per time when data is written Value instance
ite Disk to the disk of a graph type:
Write instance Float
Unit: second

ges032_avg_di Average Average I/O queue length ≥0 GES


sk_queue_len Disk of the disk in a graph Value instance
gth Queue instance type:
Length Unit: count Integer

Dimensions

Table 7-2 Dimensions


Key Value

instance_id GES instance

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 596
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Mapping Between Task Types and Names

Table 7-3 Task types and corresponding task names

Type Name

100 Querying a vertex

101 Creating a vertex

102 Deleting a vertex

103 Modifying a vertex property

104 Adding a vertex label

105 Deleting a vertex label

200 Querying an edge

201 Creating an edge

202 Deleting an edge

203 Modifying an edge property

300 Querying schema details

301 Adding a Label

302 Modifying a Label

303 Querying a Label

304 Modifying a property

400 Querying graph details

401 Clearing a graph

402 Incrementally importing graph data


online

403 Creating a graph

405 Deleting a graph

406 Exporting a graph

407 filtered_khop

408 Querying path details

409 Incrementally importing graph data


offline

500 Creating a graph backup

501 Restoring a graph from a backup

601 Creating an index.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 597
Graph Engine Service(GES)
API Reference 7 Monitoring Metrics

Type Name

602 Querying an index

603 Updating an index

604 Deleting an index

700 Running the algorithm

800 Querying an asynchronous task

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 598
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

8 Out-of-Date APIs

8.1 Management Plane APIs (V1)

8.1.1 System Management APIs

8.1.1.1 Querying Quotas

Function
This API is used to query tenant quotas.

URI
GET /v1.0/{project_id}/graphs/quotas

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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 599
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-2 Request header parameter


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-3 Response body parameter


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.


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

quotas GesQuotaRes Resource type list. This field is left blank when
p object the request fails.

Table 8-4 GesQuotaResp


Parameter Type Description

resources Array of GES resource quota list


Quota objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 600
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-5 Quota


Parameter Type Description

type String Quota type. Available values are as follows:


● "graph"
● "backup"
● "metadata"

available Integer Number of available graphs

edgeVolume Integer Number of available edges. This parameter is


available only when type is graph.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/quotas

Example Response
Status code: 200
OK
{
"quotas" : {
"resources" : [ {
"type" : "graph",
"available" : 1,
"edgeVolume" : 178800
}, {
"type" : "backup",
"available" : 7
}, {
"type" : "metadata",
"available" : 13
}]
}
}

Status Codes
Status Code Description

200 Request sent.

400 Request error.

401 Authorization failed.

403 No operation permissions.

404 No resources found.

500 Internal server error.

503 Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 601
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

8.1.2 Graph Management APIs

8.1.2.1 Querying the Graph List

Function
This API is used to query all graphs owned by the current tenant.

URI
GET /v1.0/{project_id}/graphs

Table 8-6 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.

Table 8-7 Query parameters

Parameter Mandatory Type Description

offset No Integer Start position of the request.


The default value is 0.

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

Request Parameters

Table 8-8 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 602
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Response Parameters
Status code: 200

Table 8-9 Response body parameter


Parameter Type Description

graphCount Integer Total number of graphs. This parameter is left


blank when the request fails.

graphs Array of Graph list. This parameter is left blank when


graph_1 the request fails.
objects

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. If execution succeeds, this


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

Table 8-10 graph_1


Parameter Type Description

id String Graph ID

name String Graph name

createdBy String IAM username

isMultiAz String Whether to enable cross-AZ HA

regionCode String Region code

azCode String AZ code

schemaPath Array of Path for storing the metadata file


schemaPath_
1 objects

edgesetPath Array of OBS path for storing the edge data set
edgesetPath_
1 objects

edgesetForma String Format of the edge data file


t

edgesetDefaul String Default label of the edge data file


tLabel

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 603
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

vertexsetPath Array of OBS path for storing the vertex data set
vertexsetPat
h_1 objects

vertexsetForm String Format of the vertex data file


at

vertexsetDefa String Default label of the vertex data file


ultLabel

dataStoreVers String Graph version


ion

sys_tags Array of Enterprise project information. If this


strings parameter is not specified, this function is
disabled (default).

status String Status code of a graph:


● 100: Indicates that a graph is being
prepared.
● 200: indicates that a graph is running.
● 201: indicates that a graph is upgrading.
● 202: indicates that a graph is being
imported.
● 203: indicates that a graph is being rolled
back.
● 204: indicates that a graph is being
exported.
● 205: indicates that a graph is being cleared.
● 206: indicates that the system is preparing
for resize.
● 207: indicates that the resize is in progress.
● 208: Indicates that the resize is being rolled
back.
● 210: Preparing for expansion
● 211: Expanding
● 300: indicates that a graph is faulty.
● 303: indicates that a graph fails to be
created.
● 400: indicates that a graph is deleted.
● 900: indicates that a graph is stopped.
● 901: indicates that a graph is being stopped.
● 920: indicates that a graph is being started.

actionProgres String Progress of graph operation in percentage


s

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 604
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

graphSizeType String Graph size type index:


Index ● 0: indicates 10 thousand edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million edges.
● 3: indicates 100 million edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion edges.
● 6: indicates the database edition.
● 401: indicates 1 billion enhanced edges.

vpcId String VPC ID

subnetId String Subnet ID in the VPC

securityGroup String Security group ID


Id

replication Integer Number of replicas. The default value is 1.

created String Time when a graph is created

updated String Time when a graph is updated

privateIp String Floating IP address of a graph instance. Users


can access the instance using the IP address
through the ECS deployed on a private
network.

enableFulltext Boolean Whether to enable full-text indexes


Index

enableHyG Boolean Whether to enable HyG. This parameter is


available only for database edition graphs.

enableKBQA Boolean Whether to enable intelligent Q&A

mrsClusterId String MRS cluster ID (MRS version: 3.3.1-LTS)

mrsClusterNa String MRS cluster name (MRS version: 3.3.1-LTS)


me

backupDir String Backup storage directory, which is a file path in


the HDFS.

backupConfig String Backup configuration status. The value can be


ureStatus true or false, indicating that the backup
storage directory is configured or not,
respectively.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 605
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

datastoreStat String Status of the associated MRS cluster. Available


us values are as follows:
● normal: The cluster is running normally.
● notConfigured: The cluster is not
associated.
● abnormal: The cluster is abnormal.
● checkFailed: The cluster status is unknown.

trafficIpList Array of Physical addresses of a graph instance for


strings access from private networks. To prevent
service interruption caused by floating IP
address switchover, poll the physical IP
addresses to access the graph instance.

cryptAlgorith String Graph instance cryptography algorithm.


m Available values are as follows:
● generalCipher: Chinese cryptographic
algorithm
● SMcompatible: Commercial cryptography
algorithm (compatible with international
ones)

enableHttps Boolean Whether to enable the security mode. This


mode may damage GES performance greatly.

computeType String Compute resource type. There are two types


available: ECSs and BMSs.

nodeType String Node specifications, including flavor, memory,


and data storage size.

nodeNumber Integer Number of nodes. You can use this parameter


to manage the total number of resources.

tags Array of Tag list. Each tag is in <key,value> format.


objects

Table 8-11 schemaPath_1

Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 606
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-12 edgesetPath_1


Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Table 8-13 vertexsetPath_1


Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs?offset=0&limit=10

Example Response
Status code: 200
OK
{
"graphCount": 2,
"graphs": [
{
"id": "f1529b88-c958-493e-8452-fccfe932cde1",
"name": "demo",
"regionCode": "XXX",
"azCode": "XXX",
"schemaPath": [
{
"path": "ges-graphs/demo_movie/schema.xml",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"edgesetPath": [

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 607
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

{
"path": "ges-graphs/demo_movie/edge.csv",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"vertexsetPath": [
{
"path": "",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"status": "200",
"graphSizeTypeIndex": "1",
"vpcId": "2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
"subnetId": "dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
"securityGroupId": "11d27338-8649-4076-8579-5ebc1a60f79e",
"created": "2018-07-23T04:09:44",
"updated": "2018-07-23T04:09:44",
"privateIp": "192.168.0.4",

"dataStoreVersion": "1.0.5",
"arch": "x86_64",
"enableFullTextIndex" : false
},
{
"id": "53205529-026b-455a-9e07-228fae4b12b9",
"name": "ges_c5de",
"regionCode": "XXX",
"azCode": "XXX",

"schemaPath": [
{
"path": "ges-graphs/demo_movie/schema.xml",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"edgesetPath": [
{
"path": "ges-graphs/demo_movie/edge.csv",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"vertexsetPath": [
{
"path": "",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"status": "200",
"graphSizeTypeIndex": "2",
"vpcId": "2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
"subnetId": "dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
"securityGroupId": "11d27338-8649-4076-8579-5ebc1a60f79e",
"created": "2018-07-18T13:30:16",
"updated": "2018-07-18T13:30:16",
"privateIp": "192.168.0.168",
"dataStoreVersion": "1.0.5",
"arch": "aarch64",
"enableFullTextIndex" : false
}
]
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 608
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Codes
Status Code Description

200 Request sent.

400 Request error.

401 Authorization failed.

403 No operation permissions.

404 No resources found.

500 Internal server error.

503 Service unavailable.

930 Upgrading host.

8.1.2.2 Querying Graph Details

Function
This API is used to query the details about a graph based on the graph ID.

URI
GET /v1.0/{project_id}/graphs/{graph_id}

Table 8-14 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 609
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-15 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-16 Response body parameter

Parameter Type Description

graph graph_1 Graph object. If the request fails, this


object parameter is left empty.

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.


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

Table 8-17 graph_1

Parameter Type Description

id String Graph ID

name String Graph name

createdBy String IAM username

isMultiAz String Whether to enable cross-AZ HA

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 610
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

regionCode String Region code

azCode String AZ code

schemaPath Array of Path for storing the metadata file


schemaPath
_1 objects

edgesetPath Array of OBS path for storing the edge data set
edgesetPath
_1 objects

edgesetFormat String Format of the edge data file

edgesetDefaul String Default label of the edge data file


tLabel

vertexsetPath Array of OBS path for storing the vertex data set
vertexsetPat
h_1 objects

vertexsetForm String Format of the vertex data file


at

vertexsetDefau String Default label of the vertex data file


ltLabel

dataStoreVersi String Graph version


on

sys_tags Array of Enterprise project information. If this


strings parameter is not specified, this function is
disabled (default).

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 611
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

status String Status code of a graph:


● 100: Indicates that a graph is being
prepared.
● 200: indicates that a graph is running.
● 201: indicates that a graph is upgrading.
● 202: indicates that a graph is being
imported.
● 203: indicates that a graph is being rolled
back.
● 204: indicates that a graph is being
exported.
● 205: indicates that a graph is being cleared.
● 206: indicates that the system is preparing
for resize.
● 207: indicates that the resize is in progress.
● 208: Indicates that the resize is being rolled
back.
● 210: Preparing for expansion
● 211: Expanding
● 300: indicates that a graph is faulty.
● 303: indicates that a graph fails to be
created.
● 400: indicates that a graph is deleted.
● 900: indicates that a graph is stopped.
● 901: indicates that a graph is being stopped.
● 920: indicates that a graph is being started.

actionProgress String Progress of graph operation in percentage

graphSizeTypeI String Graph size type index:


ndex ● 0: indicates 10 thousand edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million edges.
● 3: indicates 100 million edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion edges.
● 401: indicates 1 billion enhanced edges.

vpcId String VPC ID

subnetId String Subnet ID in the VPC

securityGroupI String Security group ID


d

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 612
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

replication Integer Number of replicas. The default value is 1.

created String Time when a graph is created

updated String Time when a graph is updated

privateIp String Private network access address of a graph


instance. Users can access the instance using
the IP address through the ECS deployed on
the private network.

enableFulltextI Boolean Whether to enable full-text indexes


ndex

enableHyG Boolean Whether to enable HyG. This parameter is


available only for database edition graphs.

enableKBQA Boolean Whether to enable intelligent Q&A

mrsClusterId String MRS cluster ID (MRS version: 3.3.1-LTS)

mrsClusterNa String MRS cluster name (MRS version: 3.3.1-LTS)


me

backupDir String Backup storage directory, which is a file path in


the HDFS.

backupConfigu String Backup configuration status. The value can be


reStatus true or false, indicating that the backup
storage directory is configured or not,
respectively.

datastoreStatu String Status of the associated MRS cluster. Available


s values are as follows:
● normal: The cluster is running normally.
● notConfigured: The cluster is not
associated.
● abnormal: The cluster is abnormal.
● checkFailed: The cluster status is unknown.

trafficIpList Array of Physical addresses of a graph instance for


strings access from private networks. To prevent
service interruption caused by floating IP
address switchover, poll the physical IP
addresses to access the graph instance.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 613
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

cryptAlgorithm String Graph instance cryptography algorithm.


Available values are as follows:
● generalCipher: Chinese cryptographic
algorithm
● SMcompatible: Commercial cryptography
algorithm (compatible with international
ones)

enableHttps Boolean Whether to enable the security mode. This


mode may damage GES performance greatly.

computeType String Compute resource type. There are two types


available: ECSs and BMSs.

nodeType String Node specifications, including flavor, memory,


and data storage size.

nodeNumber Integer Number of nodes. You can use this parameter


to manage the total number of resources.

tags Array of Tag list. Each tag is in <key,value> format.


strings

Table 8-18 schemaPath_1


Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Table 8-19 edgesetPath_1


Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 614
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Table 8-20 vertexsetPath_1


Parameter Type Description

jobId String Job ID corresponding to OBS file import

path String OBS storage path, excluding OBS endpoint

status String OBS file import status:


● success: Imported successfully.
● partiallyFailed: Partially failed.
● failed: Failed to import the file.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/{graph_id}

Example Response
Status code: 200
OK
{
"graph": {
"id": "f1529b88-c958-493e-8452-fccfe932cde1",
"name": "demo",
"regionCode": "XXX",
"azCode": "XXX",
"schemaPath": [
{
"path": "ges-graphs/demo_movie/schema.xml",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"edgesetPath": [
{
"path": "ges-graphs/demo_movie/edge.csv",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}
],
"vertexsetPath": [
{
"path": "",
"jobId": "ff80808167bb90340167bc7445670428",
"status": "success"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 615
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

],
"status": "200",
"graphSizeTypeIndex": "1",
"vpcId": "2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
"subnetId": "dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
"securityGroupId": "11d27338-8649-4076-8579-5ebc1a60f79e",
"created": "2018-07-23T04:09:44",
"privateIp": "192.168.0.4",

"dataStoreVersion": "1.0.5",
"arch": "x86_64"
}
}

Status Codes
Status Code Description

200 Request sent.

400 Request error.

401 Authorization failed.

403 No operation permissions.

404 No resources found.

500 Internal server error.

503 Service unavailable.

930 Upgrading host.

8.1.2.3 Creating a Graph

Function
This API is used to create a graph.

URI
POST /v1.0/{project_id}/graphs

Table 8-21 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 616
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-22 Request header parameter

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-23 Request body parameter

Parameter Mandatory Type Description

graph Yes graph object Graph type

Table 8-24 graph

Parameter Mandatory Type Description

name Yes String A graph name must start with


a letter and contains 4 to 50
characters consisting of letters,
digits, hyphens (-), and
underscores (_). It cannot
contain special characters.

graphSizeType Yes String Graph size type index:


Index ● 0: indicates 10 thousand
edges.
● 1: indicates 1 million edges.
● 2: indicates 10 million
edges.
● 3: indicates 100 million
edges.
● 4: indicates 1 billion edges.
● 5: indicates 10 billion
edges.
● 6: indicates the database
edition.
● 401: indicates 1 billion
enhanced edges.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 617
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

arch No String Graph instance's CPU


architecture type. The value
can be x86_64 or aarch64.
The default value is x86_64.
● x86_64: x86 64-bit
architecture
● aarch64: Arm 64-bit
architecture

vpcId Yes String VPC ID

subnetId Yes String Subnet ID in the VPC

securityGroup Yes String Security group ID


Id

publicIp No publicIp Public IP address. If the


object parameter is not specified,
public connection is not used
by default.

enableMultiA No Boolean Whether the created graph


z supports the cross-AZ mode.
The default value is false. If
the value is true, the system
will create the ECSs in the
graph in two AZs.
If this parameter is not
specified when you create a
graph, all ECSs in the graph
are created in one AZ.

ltsOperationTr No object Whether to enable audit logs.


ace This function is disabled by
default.

sys_tags No Array of Enterprise project information.


SysTagsRes If this parameter is not
objects specified, this function is
disabled (default).

tags No Array of TMS tags for expenses. This


SysTagsRes function is disabled by default.
objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 618
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

enableRBAC No Boolean Whether to enable granular


permission control for the
created graph. The default
value is false, indicating that
granular permission control is
disabled. If this parameter is
set to true, no user has the
permission to access the
graph. To access the graph,
you need to call the granular
permission control API of the
service plane to set the
required permissions.

enableFullTex No Boolean Whether to enable full-text


tIndex index control for the created
graph. The default value is
false, indicating that full-text
index control is disabled. Full-
text indexing can be enabled
only when GES is deployed in
ECS+MRS mode (MRS version:
3.3.1-LTS). If you set this
parameter to true, the
associated MRS cluster must
have the Elasticsearch
component deployed.

enableKBQA No Boolean Whether to enable intelligent


Q&A for the graph. By default,
this feature is disabled and the
value is false.

enableHyG No Boolean Whether to enable HyG for


the graph. This parameter is
available for database edition
graphs only.

cryptAlgorith Yes String Graph instance cryptography


m algorithm. Available values are
as follows:
● generalCipher: Chinese
cryptographic algorithm
● SMcompatible:
Commercial cryptography
algorithm (compatible with
international ones)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 619
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

enableHttps Yes Boolean Whether to enable the


security mode. This mode may
damage GES performance
greatly.

computeType Yes String Compute resource type. There


are two types available: ECSs
and BMSs.

nodeType Yes String Node specifications, including


flavor, memory, and data
storage size.

nodeNumber Yes Integer Number of nodes. You can use


this parameter to manage the
total number of resources.

tags No JsonArray Tag list. Each tag is in


<key,value> format.

Table 8-25 parameters


Parameter Mandatory Type Description

schemaPath Yes String OBS path for storing the


metadata file. Only files are
supported.

edgesetPath Yes String OBS path for storing the edge


file. Only files are supported.

edgesetForma No String Format of the edge data set.


t Currently, only the CSV format
is supported.
The CSV format is used by
default.

edgesetDefaul No String Default label of an edge data


tLabel set. This parameter is left
blank by default.

vertexsetPath No String OBS path for storing the


vertex file. Only files are
supported.

vertexsetForm No String Format of the vertex data set.


at Currently, only the CSV format
is supported.
The CSV format is used by
default.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 620
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

vertexsetDefa No String Default label of a vertex data


ultLabel set. This parameter is left
blank by default.

logDir No String OBS log storage directory. This


directory stores the data that
fails to be imported during
graph creation and detailed
logs.

parallelEdge No parallelEdge How to process repetitive


object edges.

NOTE

● For details about the value validity of the schemaPath, edgesetPath, vertexsetPath,
and logDir character strings, see the OBS Object Name Restrictions.

Table 8-26 parallelEdge


Paramete Mandato Type Description
r ry

action No String Processing mode of repetitive edges. The


value can be allow, ignore, or override.
The default value is allow.
● allow indicates that repetitive edges
are allowed.
● ignore indicates that subsequent
repetitive edges are ignored.
● override indicates that the previous
repetitive edges are overwritten.

ignoreLab No Boolean Whether to ignore labels on repetitive


el edges. The value is true or false, and the
default value is true.
● true: Indicates that the repetitive edge
definition does not contain the label.
That is, the <source vertex, target
vertex> indicates an edge, excluding
the label information.
● false: Indicates that the repetitive edge
definition contains the label. That is,
the <source vertex, target vertex, label>
indicates an edge.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 621
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-27 publicIp

Parameter Mandatory Type Description

publicBindTyp No String Binding type of an EIP. The


e value can be either of the
following:
● auto_assign
● bind_existing

eipId No String EIP ID


● If publicBindType is
bind_existing, the value is
the ID of a created EIP that
has not been bound.
● If publicBindType is
auto_assign, leave this
parameter blank.

ipType No String EIP type This parameter is


mandatory if publicBindType
is auto_assign. The default
value of this parameter is
eip_external_net.

Table 8-28 SysTagsRes

Parameter Mandatory Type Description

key No String Key of the enterprise project.


Set this parameter to
_sys_enterprise_project_id.

value No String Enterprise project ID. You can


obtain it from the enterprise
project.

Table 8-29 HDFS parameters

Procedure Man Type Description


dato
ry

mrsClusterId Yes String MRS cluster ID (MRS version: 3.3.1-LTS)

mrsClusterNa Yes String MRS cluster name (MRS version: 3.3.1-LTS)


me

managerNam Yes String Manager administrator username of the


e MRS cluster. The default value is admin.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 622
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Procedure Man Type Description


dato
ry

managerPwd Yes String Manager administrator password for


logging in to the cluster

backupDir Yes String Backup storage directory, which is a file


path in the HDFS. Generally, this parameter
is set to an empty directory.

Response Parameters
Status code: 200

Table 8-30 Response body parameters


Parameter Type Description

id String Graph ID

name String Graph name

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.

Example Request
POST https://Endpoint/v1.0/{project_id}/graphs
{
"graph":{
"name":"demo",
"graphSizeTypeIndex": "1",
"arch":"x86_64",
"vpcId":"2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
"subnetId":"dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
"securityGroupId":"11d27338-8649-4076-8579-5ebc1a60f79e",
"publicIp":{
"publicBindType":"bind_existing",
"eipId":"30ef2d58-08a9-4481-b526-b2cbe67d020d"
},
"enableMultiAz":false,
,
"enableFullTextIndex" : false,
"cryptAlgorithm": "generalCipher",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 623
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"enableHttps": "false"
}
}

Example Responses
Status code: 200

OK
{
"id" : "f1529b88-c958-493e-8452-fccfe932cde1",
"name" : "demo"
}

Status Codes
Status Code Description

200 Request sent.

400 Request error.

401 Authorization failed.

403 No operation permissions.

404 No resources found.

500 Internal server error.

503 Service unavailable.

8.1.2.4 Closing a Graph

Function
This API is used to stop a graph. After the graph is created, you can disable it if it
is not used temporarily.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-31 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 624
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-32 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


The value can be:
● stop

Request Parameters

Table 8-33 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-34 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 625
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

jobId String ID of the graph stopping job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Example Request
POST https://Endpoint//v1.0/{project_id}/graphs/{graph_id}/action?action_id=stop

Example Response
Status code: 200
OK
{
"jobId" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7001",
"errorMessage" : "The graph is not running."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 626
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

8.1.2.5 Starting a Graph

Function
This API is used to start a graph. You can disable a graph if it is not used
temporarily.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-35 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_id Yes String Graph ID

Table 8-36 Query parameters

Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to the
enumeration value start,
which means the graph will be
started.

Request Parameters

Table 8-37 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 627
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-38 Request body parameters


Parameter Mandatory Type Description

graph_backup No String Backup ID associated during


_id graph startup. If this
parameter is configured, the
graph starts from the backup.
If this parameter is left blank,
the graph starts from the
status when it was closed last
time. For details about how to
back up a graph, see section
Adding a Backup.

Response Parameters
Status code: 200

Table 8-39 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.


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

jobId String ID of the graph startup job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Example Request
https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=start

{
"graph_backup_id" : "08a898ae-3ff8-40e8-a7ed-03afe05aedbb"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 628
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Example Response
Status code: 200
OK
{
"jobId" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7015",
"errorMessage" : "The graph is not running or stopped."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.6 Deleting a Graph

Function
This API is used to delete a graph.

URI
DELETE /v1.0/{project_id}/graphs/{graph_id}

Table 8-40 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 629
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-41 Query parameters


Parameter Mandatory Type Description

keepBackup No Boolean Whether to retain the backups


of a graph after it is deleted.
By default, one automatic
backup and two manual
backups are retained. If this
parameter is left empty, no
backups are retained.

Request Parameters

Table 8-42 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-43 Response body parameter


Parameter Type Description

jobId String ID of the graph deletion job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 630
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

errorCode String System prompt.


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

Example Request
DELETE https://Endpoint/v1.0/{project_id}/graphs/{graph_id}

Example Response
Example response with status code 200:
OK
{
"jobId" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7000",
"errorMessage" : "The graph does not exist or has been deleted."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.7 Incrementally Importing Data to a Graph

Function
This API is used to import data to graphs incrementally.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 631
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

NOTE

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

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-44 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_id Yes String Graph ID

Table 8-45 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to the
enumeration value import-
graph, which means the
incremental data will be
imported to the target graph.

Request Parameters

Table 8-46 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 632
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-47 Request body parameters


Parameter Mandatory Type Description

edgesetPath No String Edge file directory or name

edgesetForma No String Format of the edge data set.


t Currently, only the CSV format
is supported.
The CSV format is used by
default.

vertexsetPath No String Vertex file directory or name

vertexsetForm No String Format of the vertex data set.


at Currently, only the CSV format
is supported.
The CSV format is used by
default.

schemaPath No String Path for storing the metadata


file of the new data.

logDir No String Directory for storing logs of


imported graphs. This
directory stores the data that
fails to be imported during
graph creation and detailed
error causes.

parallelEdge No Object Repetitive edge processing


This parameter is not available
for database edition graphs.

action No String Processing mode of repetitive


edges. The value can be
allow, ignore, or override.
The default value is allow.
● allow indicates that
repetitive edges are
allowed.
● ignore indicates that
subsequent repetitive edges
are ignored.
● override indicates that the
previous repetitive edges
are overwritten.
This parameter is not available
for database edition graphs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 633
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

ignoreLabel No Boolean Whether to ignore labels on


repetitive edges. The value is
true or false, and the default
value is true.
● true: Indicates that the
repetitive edge definition
does not contain the label.
That is, the <source vertex,
target vertex> indicates an
edge, excluding the label
information.
● false: Indicates that the
repetitive edge definition
contains the label. That is,
the <source vertex, target
vertex, label> indicates an
edge.
This parameter is not available
for database edition graphs.

delimiter No String 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 String Field quote character in a CSV


file. The default value is
double quotation marks ("). It
is used to enclose a field if the
field contains separators or
line breaks.

offline No Boolean Whether offline import is


selected. The value is true or
false, and the default value is
false.
● true: Offline import is
selected. The import speed
is high, but the graph is
locked and cannot be read
or written during the
import.
● false: Online import is
selected. Compared with
offline import, online
import is slower. However,
the graph can be read
(cannot be written) during
the import.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 634
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

NOTE

● For details about the value validity of the edgesetPath, vertexsetPath, schemaPath,
and logDir character strings, see the OBS Object Name Restrictions.

Response Parameters
Status code: 200

Table 8-48 Response body parameter


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.


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

jobId String Indicates the ID of an asynchronous job.


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

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=import-graph
{
"edgesetPath": "testbucket/demo_movie/edges/",
"edgesetFormat": "csv",
"vertexsetPath": "testbucket/demo_movie/vertices/",
"vertexsetFormat": "csv",
"schemaPath": "testbucket/demo_movie/incremental_data_schema.xml",
"logDir": "testbucket/importlogdir",
"parallelEdge": {
"action":"override",
"ignoreLabel":true
},
"delimiter": ",",
"trimQuote": "\"",
"offline": true
}

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 635
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

OK
{
"jobId" : "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
}

Status code: 400

Bad Request
{
"errorMessage" : "parameter format error",
"errorCode" : "GES.8013"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.8 Exporting a Graph

Function
This API is used to export a graph.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-49 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_id Yes String Graph ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 636
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-50 Query parameters

Parameter Mandatory Type Description

action_id Yes String Graph action ID


The value can be:
● export-graph

Request Parameters

Table 8-51 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-52 Request body parameters

Parameter Mandatory Type Description

graphExportP Yes String OBS path to which a graph is


ath exported

edgeSetName Yes String Exported edge file name

vertexSetNam Yes String Exported vertex file name


e

schemaName Yes String Name of the exported


metadata file

NOTE

● For details about the value validity of the graphExportPath character strings, see the
OBS Object Name Restrictions.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 637
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-53 Response body parameter

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.


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

jobId String ID of an asynchronous job


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

NOTE

● For details about the value validity of the graphExportPath character strings, see the
OBS Object Name Restrictions.

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=export-graph

{
"graphExportPath" : "demo_movie/",
"edgeSetName" : "set_edge.csv",
"vertexSetName" : "set_vertex.csv",
"schemaName" : "set_schema.xml"
}

Example Response
Status code: 200

OK
{
"jobId" : "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400

Bad Request
{
"errorMessage" : "graph [demo] is not found",
"errorCode" : "GES.8011"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 638
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.9 Clearing a Graph

Function
This API is used to clear all data in a graph.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-54 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_id Yes String Graph ID

Table 8-55 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to the
enumeration value clear-
graph, which means that all
data in the target graph will
be cleared.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 639
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

clear- No Boolean Whether to clear graph


metadata metadata. Set this parameter
to true. The value can be true
or false. The default value is
false.
● true: The metadata will be
cleared.
● false: The metadata will
not be cleared.

Request Parameters

Table 8-56 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-57 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.


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

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 640
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

jobId String ID of an asynchronous job.


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

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=clear-graph&clear-metadata=true

Example Response
Status code: 200
OK
{
"jobId" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Bad Request
{
"errorMessage" : "graph [demo] is not found",
"errorCode" : "GES.8012"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.10 Upgrading a Graph

Function
This API is used to upgrade a graph. The GES version is periodically upgraded. You
can upgrade your graphs as required.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 641
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-58 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_id Yes String Graph ID

Table 8-59 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to the
enumeration value upgrade,
which means that the graph
will be upgraded.

Request Parameters

Table 8-60 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-61 Request body parameters


Parameter Mandatory Type Description

upgradeVersio Yes String Target version, which must be


n later than the current version

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 642
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Mandatory Type Description

forceUpgrade No Boolean Whether to upgrade forcibly.


The value is true or false, and
the default value is false.
● true: forcible upgrades,
which will interrupt running
tasks, such as long
algorithm execution tasks.
As a result, a small number
of requests may fail.
● false: non-forcible
upgrades, which will wait
for running services to
complete. The upgrade
process may be slow.

Response Parameters
Status code: 200

Table 8-62 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.

jobId String ID of an asynchronous job


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

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=upgrade

{
"upgradeVersion" : "1.1.8",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 643
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"forceUpgrade" : false
}

Example Response
Status code: 200
OK
{
"jobId" : "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
}

Status code: 400


Bad Request
{
"errorMessage" : "graph [demo] is not found",
"errorCode" : "GES.8011"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.11 Binding an EIP

Function
This API enables you to access GES by binding an elastic IP (EIP).

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 644
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-63 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_id Yes String Graph ID

Table 8-64 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to bindEip,
which means that an EIP will
be bound to the target graph.

Request Parameters

Table 8-65 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-66 Request body parameters


Parameter Mandatory Type Description

eipId Yes String ID of the elastic IP address

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 645
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-67 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.

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=bindEip

{
"eipId" : "02bd6dc1-5be8-430e-a4cd-2b0f6d0bb042"
}

Example Response
Status code: 200

OK
{}

Status code: 400

Bad Request
{
"errorMessage" : "graph [demo] is not found",
"errorCode" : "GES.8011"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 646
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code Description

503 Service unavailable.

8.1.2.12 Unbinding an EIP

Function
If you do not need to use the EIP, this API enabled you to unbind the EIP to release
network resources.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-68 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_id Yes String Graph ID

Table 8-69 Query parameters


Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to
unbindEip, which means that
the EIP will be unbound from
the target graph.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 647
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-70 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-71 Request body parameters

Parameter Mandatory Type Description

eipId Yes String ID of the elastic IP address.

Response Parameters
Status code: 200

Table 8-72 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.

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=unbindEip

{
"eipId" : "02bd6dc1-5be8-430e-a4cd-2b0f6d0bb042"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 648
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Example Responses
Status code: 200
OK
{}

Status code: 400


Bad Request
{
"errorMessage" : "graph [demo] is not found",
"errorCode" : "GES.8011"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.13 Resizing a Graph

Function
This API is used to resize a graph instance.

NOTE

After the graph is resized, you need to re-create all indexes.


Memory edition graphs deployed on a BMS cannot be resized.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/resize

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 649
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-73 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_id Yes String Graph ID

Request Parameters

Table 8-74 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-75 Request body parameters


Parameter Mandatory Type Description

resize Yes GraphSizeTyp Graph specifications after the


eIndexReq graph is resized.
object

Table 8-76 GraphSizeTypeIndexReq


Parameter Mandatory Type Description

graphSizeType Yes String Graph flavor. Currently, the


Index value can be 2, 3, 4, or 5,
indicating 10-million-edge,
100-million-edge, 1-billion-
edge, or 10-billion-edge,
respectively.
(graph_size_type_index)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 650
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Response Parameters
Status code: 200

Table 8-77 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.

jobId String Indicates the ID of the resize job. This


parameter is left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Job Management APIs.

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/resize

{
"resize" : {
"graphSizeTypeIndex" : "2"
}
}

Example Response
Status code: 200

OK
{}

Status code: 400

Bad Request
{
"errorCode" : "GES.7001",
"errorMessage" : "The graph is not running."
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 651
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.14 Restarting a Graph

Function
This API is used to forcibly start a graph in the importing, exporting, running, or
clearing state. If a graph is forcibly restarted, asynchronous tasks of the graph are
failed state and the graph is stopped and started.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/action

Table 8-78 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_id Yes String Graph ID

Table 8-79 Query parameters

Parameter Mandatory Type Description

action_id Yes String Graph action ID


Set this parameter to restart,
which means that the target
graph will be restarted.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 652
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-80 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-81 Response body parameters

Parameter Type Description

errorMessage String System prompt code.


● 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.

jobId String ID of a forcible restart job. This parameter is


left blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Example Request
POST https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/action?action_id=restart

Example Response
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 653
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

OK
{}

Status code: 400


Bad Request
{
"errorMessage" : "The request is invalid.",
"errorCode" : "GES.7016"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.2.15 Expanding a Graph

Function
This API is used to expand multiple secondary nodes dynamically. The expanded
secondary nodes can process read requests, improving read performance.

NOTE

1. This API is not supported by graphs of the 10,000-edge and 10-billion-edge types.
2. Graphs cannot be resized after expansion.
3. If you want to resize and expand the graph, resize the graph before you expand it.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/expand

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 654
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-82 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_id Yes String Graph ID

Request Parameters

Table 8-83 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-84 Request body parameters


Parameter Mandatory Type Description

expand Yes ReplicationR Expansion information


eq object

Table 8-85 ReplicationReq


Parameter Mandatory Type Description

replication Yes String Number of new nodes to


expand

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 655
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-86 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.

jobId String ID of the expansion job. This parameter is left


blank when the request fails.
NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Example Request
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_id}/expand

{
"expand": {
"replication" : "1"
}
}

Example Responses
Status code: 200
OK
{
"jobId" : "ff8080816025a0a1016025a5a2700007"
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7015",
"errorMessage" : "The graph is not running or stopped."
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 656
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.3 Backup Management APIs

8.1.3.1 Viewing the List of All Backups

Function
This API is used to query the list of all backups.

URI
GET /v1.0/{project_id}/graphs/backups

Table 8-87 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.

Table 8-88 Query parameters

Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 657
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-89 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-90 Response body parameter

Parameter Type Description

errorMessage String System prompt code.


● 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.

backupCount Integer Total number of backups. This parameter is left


blank if the request fails.

backupList Array of List of all backups under the current project ID.
backup This parameter is left blank if the request fails.
objects

Table 8-91 backup

Parameter Type Description

id String Backup ID

name String Backup name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 658
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

backupMetho String Backup method. The value can be auto or


d manual.

graphId String ID of the graph associated with the backup

graphName String Name of the graph associated with the backup

graphStatus String Status of the graph associated with the backup

graphSizeType String Size of the graph associated with the backup


Index

dataStoreVers String Version of the graph associated with the


ion backup

arch String CPU architecture of the graph node associated


with the backup

status String Backup status:


● backing_up: indicates that a graph is being
backed up.
● success: indicates that a graph is
successfully backed up.
● failed: indicates that a graph fails to be
backed up.

startTimesta Long Start timestamp of a backup job


mp

startTime String Backup start time

endTimestam Long End timestamp of a backup job


p

endTime String Backup end time

size Long Backup file size (MB)

duration Long Backup duration (seconds)

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/backups?offset=0&limit=2

Example Response
Example response with status code 200:
OK
{
"backupCount": 3,
"backupList": [
{
"id": "ada3e720-ab87-48cb-bff7-3ec5ae1a9652",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 659
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"name": "ges060803_nodelete-20210608135513",
"backupMethod": "manual",
"graphId": "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graphName": "ges060803_nodelete",
"graphStatus": "200",
"graphSizeTypeIndex": "1",
"dataStoreVersion": "2.2.21",
"arch": "x86_64",
"status": "success",
"startTimestamp": 1623160513000,
"startTime": "2021-06-08T13:55:13",
"endTimestamp": 1623160568000,
"endTime": "2021-06-08T13:56:08",
"size": 1,
"duration": 54,
"encrypted": false
},
{
"id": "7ed3f51d-816d-4651-9129-fe21b64b5c91",
"name": "ges060803_nodelete_20210609203323_auto",
"backupMethod": "auto",
"graphId": "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graphName": "ges060803_nodelete",
"graphStatus": "200",
"graphSizeTypeIndex": "1",
"dataStoreVersion": "2.2.21",
"arch": "x86_64",
"status": "success",
"startTimestamp": 1623242004000,
"startTime": "2021-06-09T12:33:24",
"endTimestamp": 1623242004000,
"endTime": "2021-06-09T12:33:24",
"size": 1,
"duration": 0,
"encrypted": false
},
{
"id": "604bfb46-04dd-45fc-a9ae-df24a0705b9d",
"name": "ges060802_nodelete-20210608135523",
"backupMethod": "manual",
"graphId": "9b9a05c2-0cdb-41ac-b55f-93caffb0519a",
"graphName": "ges060802_nodelete",
"graphStatus": "400",
"graphSizeTypeIndex": "0",
"dataStoreVersion": "2.2.23",
"arch": "x86_64",
"status": "success",
"startTimestamp": 1623160524000,
"startTime": "2021-06-08T13:55:24",
"endTimestamp": 1623160577000,
"endTime": "2021-06-08T13:56:17",
"size": 1,
"duration": 53,
"encrypted": false
}
]
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7006",
"errorMessage" : "The underlying graph engine has internal error."
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 660
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.3.2 Viewing the Backup List of a Graph

Function
This API is used to query the backup list of a graph.

URI
GET /v1.0/{project_id}/graphs/{graph_id}/backups

Table 8-92 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_id Yes String Graph ID

Table 8-93 Query parameters

Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 661
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-94 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-95 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.

backupCount Integer Total number of backups. This parameter is left


blank if the request fails.

backupList Array of List of backups of a specified graph under the


backup current project. This parameter is left blank if
objects the request fails.

Table 8-96 backup

Parameter Type Description

id String Backup ID

name String Backup name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 662
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

backupMetho String Backup method. The value can be auto or


d manual.

graphId String ID of the graph associated with the backup

graphName String Name of the graph associated with the backup

graphStatus String Status of the graph associated with the backup

graphSizeType String Size of the graph associated with the backup


Index

dataStoreVers String Version of the graph associated with the


ion backup

arch String CPU architecture of the graph node associated


with the backup

status String Backup status:


● backing_up: indicates that a graph is being
backed up.
● success: indicates that a graph is
successfully backed up.
● failed: indicates that a graph fails to be
backed up.

startTimesta Long Start timestamp of a backup job


mp

startTime String Backup start time

endTimestam Long End timestamp of a backup job


p

endTime String Backup end time

size Long Backup file size (MB)

duration Long Backup duration (seconds)

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/backups?offset=0&limit=2

Example Response
Example response with status code 200:
OK
{
"backupCount": 2,
"backupList": [
{
"id": "ada3e720-ab87-48cb-bff7-3ec5ae1a9652",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 663
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"name": "ges060803_nodelete-20210608135513",
"backupMethod": "manual",
"graphId": "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graphName": "ges060803_nodelete",
"graphStatus": "200",
"graphSizeTypeIndex": "1",
"dataStoreVersion": "2.2.22",
"arch": "x86_64",
"status": "success",
"startTimestamp": 1623160513000,
"startTime": "2021-06-08T13:55:13",
"endTimestamp": 1623160568000,
"endTime": "2021-06-08T13:56:08",
"size": 1,
"duration": 54,
"encrypted": false
},
{
"id": "7ed3f51d-816d-4651-9129-fe21b64b5c91",
"name": "ges060803_nodelete_20210609203323_auto",
"backupMethod": "auto",
"graphId": "4c5f882d-a813-4d78-a8e3-6d3212ddd121",
"graphName": "ges060803_nodelete",
"graphStatus": "200",
"graphSizeTypeIndex": "1",
"dataStoreVersion": "2.2.21",
"arch": "x86_64",
"status": "success",
"startTimestamp": 1623242004000,
"startTime": "2021-06-09T12:33:24",
"endTimestamp": 1623242004000,
"endTime": "2021-06-09T12:33:24",
"size": 1,
"duration": 0,
"encrypted": false
}
]
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7000",
"errorMessage" : "The graph does not exist or has been deleted."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 664
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

8.1.3.3 Adding a Backup

Function
This API is used to add a backup. If data in the current graph is incorrect or faulty,
you can start the backup graph to restore the data.

URI
POST /v1.0/{project_id}/graphs/{graph_id}/backups

Table 8-97 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_id Yes String Graph ID

Request Parameters

Table 8-98 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 665
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-99 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.

jobId String ID of the graph backup job.


NOTE
You can view the job execution status and obtain the
return result by querying the job ID. For details, see
Task Center APIs.

Example Request
POST https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/backups

Example Response
Example response with status code 200:
OK
{
"jobId" : "ff8080815f9a3c84015f9a438ff70001"
}

Status code: 400


Bad Request
{
"errorCode" : "GES.7000",
"errorMessage" : "The graph does not exist or has been deleted."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 666
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code Description

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.3.4 Deleting a Backup

Function
This API is used to delete a backup.

URI
DELETE /v1.0/{project_id}/graphs/{graph_id}/backups/{backup_id}

Table 8-100 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.

backup_id Yes String Graph backup ID

graph_id Yes String Graph ID

Request Parameters

Table 8-101 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 667
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-102 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.

Example Request
DELETE https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/backups/{backupId}

Example Response
Status code: 200

OK
{}

Status code: 400

Bad Request
{
"errorMessage" : "Parameter error!",
"errorCode" : "GES.0001"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 668
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

8.1.4 Metadata Management APIs

8.1.4.1 Constraints
Table 8-103 and Table 8-104 list the metadata types.

Table 8-103 Metadata property constraints

Data Type Constraints

char ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

char array ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

float ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

double ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

bool ● Equal to (=)


● Not equal to (!=)

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 669
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Data Type Constraints

long ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

int ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

date ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

enum ● Equal to (=)


● Not equal to (!=)

string ● Less than (<)


● Greater than (>)
● Equal to (=)
● Not equal to (!=)
● In range (range)
● Greater than or equal to (>=)
● Less than or equal to (<=)

Table 8-104 Property-level constraints


Property Level Constraints Description

Single value/ has This property is contained.


Multiple values

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 670
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Property Level Constraints Description

Single value/ hasNot This property is not contained.


Multiple values

8.1.4.2 Querying the Metadata List

Function
This API is used to query the metadata list.

URI
GET /v1.0/{project_id}/graphs/metadatas

Table 8-105 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.

Table 8-106 Query parameters


Parameter Mandatory Type Description

limit No Integer Maximum number of


resources displayed on a single
page. The default value is 10.

offset No Integer Start position of the request.


The default value is 0.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 671
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-107 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-108 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.

schemaCount Integer Number of returned metadata files. This


parameter is left blank if the request fails.

schemaList Array of List of all metadata files under the current


metadata project ID. This parameter is left blank if the
objects request fails.

Table 8-109 metadata

Parameter Type Description

id String Metadata ID

name String Metadata name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 672
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

description String Metadata description

status String Whether the metadata is available

metadataPath String Metadata path

startTime String Metadata creation time

lastUpdateTi String Last update time of the metadata


me

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/metadatas?offset=10&limit=100

Example Response
Status code: 200

OK
{
"schemaCount": 1,
"schemaList" : [ {
"id" : "ff7dddc4-6402-43d7-9aed-c5ec677b47fa",
"name" : "schema_demo",
"description" : "",
"status" : "200",
"metadataPath" : "ges-graphs/demo_movie/schema.xml",
"startTime" : "2018-07-23T02:59:41",
"lastUpdateTime" : "2018-07-23T02:59:41"
}]
}

Status code: 500

Internal Server Error


{
"errorCode" : "GES.7006",
"errorMessage" : "The underlying graph engine has internal error."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 673
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code Description

500 Internal service error.

503 Service unavailable.

8.1.4.3 Querying Metadata

Function
This API is used to query the metadata of a graph.

URI
GET /v1.0/{project_id}/graphs/metadatas/{metadata_id}

Table 8-110 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.

metadata_id Yes String Metadata ID

Request Parameters

Table 8-111 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 674
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-112 Response body parameters


Parameter Type Description

errorMessage String System prompt code.


● 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.

gesMetadata GesMetaDat Object for storing metadata message


a object information.

Table 8-113 GesMetaData


Parameter Type Description

labels Array of Label data structure set


Label objects

Table 8-114 Label


Parameter Type Description

name String Label name

properties Object Maps of metadata properties. The key-value


pairs are those in the imported metadata.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/metadatas/{metadata_id}

Example Response
Example response with status code 200:
OK
{
"gesMetadata": {
"labels": [
{
"name": "friends",
"properties": null

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 675
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

},
{
"name": "movie",
"properties": [
{
"dataType": "string",
"name": "Title",
"cardinality": "single"
},
{
"dataType": "int",
"name": "Year",
"cardinality": "single"
},
{
"dataType": "string",
"name": "Genres",
"cardinality": "set"
}
]
},
{
"name": "user",
"properties": [
{
"dataType": "string",
"name": "Title",
"cardinality": "single"
},
{
"dataType": "int",
"name": "Year",
"cardinality": "single"
},
{
"dataType": "string",
"name": "Genres",
"cardinality": "set"
}{
"typeName1": "F",
"typeName2": "M",
"typeNameCount": "2",
"dataType": "enum",
"name": "Gender",
"cardinality": "single"
},
{
"typeName1": "Under 18",
"typeName2": "18-24",
"typeName3": "25-34",
"typeName4": "35-44",
"typeNameCount": "7",
"dataType": "enum",
"name": "Age",
"typeName5": "45-49",
"typeName6": "50-55",
"cardinality": "single",
"typeName7": "56+"
},
{
"dataType": "string",
"name": "Occupation",
"cardinality": "single"
},
{
"dataType": "char array",
"name": "Zip-code",
"maxDataSize": "12",
"cardinality": "single"

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 676
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

}
]
},
{
"name": "rate",
"properties": [
{
"dataType": "int",
"name": "Score",
"cardinality": "single"
},
{
"dataType": "date",
"name": "Datetime",
"cardinality": "single"
}
]
}
]
}
}

Status code: 500

Internal Server Error


{
"errorCode" : "GES.7006",
"errorMessage" : "The underlying graph engine has internal error."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.4.4 Adding Metadata

Function
This API is used to add the metadata.

URI
POST /v1.0/{project_id}/graphs/metadatas

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 677
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-115 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.

Request Parameters

Table 8-116 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-117 Request body parameters


Parameter Mandatory Type Description

metadataPath Yes String Metadata storage address

name Yes String Metadata name, which


contains 1 to 64 characters
consisting of only letters,
digits, and underscores (_)

description Yes String Metadata description

isOverwrite Yes Boolean Whether to overwrite existing


files The value can be true or
false. The default value is
false.
● true: Existing file will be
overwritten.
● false: Existing file will not
be overwritten.

gesMetadata Yes Object Object for storing metadata


message information.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 678
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Response Parameters
Status code: 200

Table 8-118 Response body parameter


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.

id String Metadata ID

name String Metadata name

Example Request
POST https://Endpoint/v1.0/{project_id}/graphs/metadatas
{
"metadataPath": "gesdata/demo_movie/schema.xml",
"name": "movie_schema",
"description": "xxxxx",
"isOverwrite": "true",
"gesMetadata": {
"labels": [
{
"name": "friends",
"properties": null
},
{
"name": "movie",
"properties": [
{
"dataType": "string",
"name": "Title",
"cardinality": "single"
},
{
"dataType": "int",
"name": "Year",
"cardinality": "single"
},
{
"dataType": "string",
"name": "Genres",
"cardinality": "set"
}
]
},
{
"name": "user",

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 679
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"properties": [
{
"dataType": "string",
"name": "Name",
"cardinality": "single"
},
{
"typeName1": "F",
"typeName2": "M",
"typeNameCount": "2",
"dataType": "enum",
"name": "Gender",
"cardinality": "single"
},
{
"typeName1": "Under 18",
"typeName2": "18-24",
"typeName3": "25-34",
"typeName4": "35-44",
"typeNameCount": "7",
"dataType": "enum",
"name": "Age",
"typeName5": "45-49",
"typeName6": "50-55",
"cardinality": "single",
"typeName7": "56+"
},
{
"dataType": "string",
"name": "Occupation",
"cardinality": "single"
},
{
"dataType": "char array",
"name": "Zip-code",
"maxDataSize": "12",
"cardinality": "single"
}
]
},
{
"name": "rate",
"properties": [
{
"dataType": "int",
"name": "Score",
"cardinality": "single"
},
{
"dataType": "date",
"name": "Datetime",
"cardinality": "single"
}
]
}
]
}
}

Example Response
Example response with status code 200:
OK
{
"id" : "ff8080815f9a3c84015f9a438ff70001",
"name" : "movie_schema"
}

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 680
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status code: 500


Internal Server Error
{
"errorCode" : "GES.2067",
"errorMessage" : "name: 1 to 64 characters, only letters, digits, and underscores(_) are allowed."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.4.5 Deleting Metadata

Function
This API is used to delete the metadata.

URI
DELETE /v1.0/{project_id}/graphs/metadatas/{metadata_id}

Table 8-119 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.

metadata_id Yes String Metadata ID

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 681
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-120 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-121 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.

Example Request
DELETE https://Endpoint/v1.0/{project_id}/graphs/metadatas/{metadata_id}

Example Response
Status code: 200

OK
{}

Status code: 400

Bad Request

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 682
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

{
"errorCode" : "GES.7024",
"errorMessage" : "The metadata is not exist or has been deleted."
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.4.6 Importing Metadata from OBS

Function
This API is used to import metadata from OBS.

URI
POST /v1.0/{project_id}/graphs/metadata/upload_from_obs

Table 8-122 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 683
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Request Parameters

Table 8-123 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Table 8-124 Request body parameters

Parameter Mandatory Type Description

metadataPath Yes String Path for storing the metadata

name Yes String Metadata name

description No String Metadata description

Response Parameters
Status code: 200

Table 8-125 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.

id String Metadata ID

name String Metadata name

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 684
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Example Request
POST https://Endpoint/v1.0/{project_id}/graphs/metadata/upload_from_obs
{
"metadataPath": "devdata/unionsdk/schema.xml",
"name": "test_schema",
"description": "",
"encryption": {}
}

Example Response
Example response with status code 200:
OK
{
"id" : "d30d2e94-f2ee-4344-af49-eb27fd002eea",
"name" : "test_schema"
}

Status code: 404


Internal Server Error
{
"errorCode": "GES.0016",
"errorMessage": "Resource not found"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.5 Task Center APIs

8.1.5.1 Querying Job Status on the Management Plane

Function
This API is used to query the execution status of a job. Asynchronous APIs that are
used to create, stop, start, delete, and import graphs will return job IDs after
commands are sent. You can query the job execution status according to the job
IDs.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 685
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

URI
GET /v1.0/{project_id}/graphs/{graph_id}/jobs/{job_id}/status

Table 8-126 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_id Yes String Graph ID

job_id Yes String ID of the asynchronous job

Request Parameters

Table 8-127 Parameters in the request header


Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Table 8-128 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 686
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

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.

jobId String Job ID

status String Job status:


● pending
● running
● success
● failed

jobType Integer Job type

jobName String Job name

relatedGraph String Associated graph name

beginTime String Job start time (UTC). The format is (yyyy-MM-


dd HH:mm:ss).

endTime String Job end time (UTC). The format is (yyyy-MM-


dd HH:mm:ss).

jobDetail JobDetail This parameter is returned only when


object jobName is set to ImportGraph and is used to
display graph import details.

failReason String Job failure cause

jobProgress Double Job execution progress. It is a reserved field,


and not used currently.

Table 8-129 JobDetail


Parameter Type Description

schemaPath Array of Path for storing metadata


schemaPath
objects

edgesetPath Array of Path for storing the edge data set


edgesetPath
objects

vertexsetPath Array of Path for storing the vertex data set


vertexsetPat
h objects

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 687
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-130 schemaPath


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

Table 8-131 edgesetPath


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

totalLines Long The total number of imported lines, which is


subject to your quota and the specifications of
the created graph. The value -1 indicates that
this field is not returned in the current version.

failedLines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successfulLine Long Lines imported successfully. The value -1


s indicates that this field is not returned in the
current version.

Table 8-132 vertexsetPath


Parameter Type Description

path String OBS storage path

log String Import log

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 688
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

totalLines Long Total number of imported lines. The value is


subject to your quota and specifications of the
created graph. If the value is -1, this parameter
is not supported by the current version.

failedLines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successfulLine Long Lines imported successfully. The value -1


s indicates that this field is not returned in the
current version.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/{graph_id}/jobs/{job_id}/status

Example Response
Status code: 200
OK
Http Status Code: 200
{
"jobId": "ff80808167f09aaa0167f19b35ec0305",
"status": "success",
"jobType": "GraphManagement",
"jobName": "ImportGraph",
"relatedGraph": "GES_UI_AUTO",
"beginTime": "2018-11-27T21:39:00",
"endTime": "2018-11-27T21:39:56",
"jobDetail": {
"vertexsetPath": [
{
"path": "ges-ui/auDatas/list_set_vertex.csv",
"log": null,
"cause": null,
"status": "success"
}
],
"edgesetPath": [
{
"path": "ges-ui/auDatas/list_set_edge.csv",
"log": null,
"cause": null,
"status": "success"
}
],
"schemaPath": [

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 689
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

{
"path": "ges-ui/auDatas/list_set_schema.xml",
"log": null,
"cause": null,
"status": "success"
}
]
},
"jobProgress": 0
}

Status code: 400


Bad Request
{
"errorMessage" : "can not find job, jobId is ff808081646e81d40164c5fb414b2b1a1",
"errorCode" : "GES.8301"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

500 Internal service error.

503 Service unavailable.

8.1.5.2 Querying Job Details in the Job Center

Function
This API is used to query asynchronous job details in the job center on the
management plane. Asynchronous jobs include creating, closing, starting, deleting,
adding, importing, exporting, and upgrading graphs, as well as adding backups.

URI
GET /v1.0/{project_id}/graphs/jobs

Table 8-133 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.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 690
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-134 Query parameters

Parameter Mandatory Type Description

endTime No String Job end date. Currently, only


the date is supported. The
format is yyyy-MM-dd, for
example, 2019-03-27.

graph_name No String Associated graph name

limit No String Maximum number of


resources displayed on a single
page. The default value is 10.

offset No String Start position of the request.


The default value is 0.

startTime No String Job start date. Currently, only


the date is supported. The
format is yyyy-MM-dd, for
example, 2019-03-27.

status No String Job status. Possible values:


● running
● waiting
● success
● failed

Request Parameters

Table 8-135 Parameters in the request header

Parameter Mandatory Type Description

X-Auth-Token Yes String User token.


It is used to obtain the
permission to call APIs. For
details about how to obtain
the token, see
Authentication. The value of
X-Subject-Token in the
response header is the token.

Response Parameters
Status code: 200

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 691
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-136 Response body parameter

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.

jobCount Integer Total number of jobs

jobList Array of Job Task list


objects

Table 8-137 Job

Parameter Type Description

jobId String Job ID

status String Job status.


● pending
● running
● success
● failed

jobType Integer Task type

jobName String Task name

relatedGraph String Associated graph name

beginTime String Job start time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

endTime String Job end time (UTC). The format is yyyy-MM-


dd'T'HH:mm:ss.

jobDetail JobDetail This parameter is returned only when


object jobName is set to ImportGraph and is used to
display graph import details.

failReason String Job failure cause

jobProgress Double Job execution progress. It is a reserved field,


and not used currently.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 692
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Table 8-138 JobDetail


Parameter Type Description

schemaPath Array of Path for storing metadata


schemaPath
objects

edgesetPath Array of Path for storing the edge data set


edgesetPath
objects

vertexsetPath Array of Path for storing the vertex data set


vertexsetPat
h objects

Table 8-139 schemaPath


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

Table 8-140 edgesetPath


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 693
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Parameter Type Description

totalLines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failedLines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successfulLine Long Lines imported successfully. The value -1


s indicates that this field is not returned in the
current version.

Table 8-141 vertexsetPath


Parameter Type Description

path String OBS storage path

log String Import log

status String OBS file status:


● success: Imported successfully.
● Failed: Failed to import the file.
● partFailed: Partially failed.

cause String Import failure cause

totalLines Long Total number of imported lines. The value -1


indicates that this field is not returned in the
current version.

failedLines Long Lines failed to be imported. The value -1


indicates that this field is not returned in the
current version.

successfulLine Long Lines imported successfully. The value -1


s indicates that this field is not returned in the
current version.

Example Request
GET https://Endpoint/v1.0/{project_id}/graphs/jobs?offset=0&limit=100

Example Response
Example response with status code 200:
OK
Http Status Code: 200
{

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 694
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

"jobCount": 136,
"jobList": [
{
"jobId": "ff80808167bb90340167bc3c7b5b026a",
"status": "success",
"jobType": "GraphManagement",
"jobName": "ImportGraph",
"relatedGraph": "test1217",
"beginTime": "2018-12-17T12:55:40",
"endTime": "2018-12-17T12:56:32",
"jobDetail": {
"vertexsetPath": null,
"edgesetPath": [
{
"path": "hkmovie/edge.csv",
"log": null,
"cause": null,
"status": "success"
}
],
"schemaPath": [
{
"path": "hkmovie/schema.xml",
"log": null,
"cause": null,
"status": "success"
}
]
},
"jobProgress": 0
},
{
"jobId": "ff80808167bb90340167bc5d0b1d0358",
"status": "success",
"jobType": "GraphManagement",
"jobName": "DeleteGraph",
"relatedGraph": "test1218",
"beginTime": "2018-12-17T13:31:14",
"endTime": "2018-12-17T13:34:48",
"jobProgress": 0
}
]
}

Status code: 400

Bad Request
{
"errorMessage" : "failed",
"errorCode" : "GES.9999"
}

Status Code
Status Code Description

200 Request sent.

400 Request error.

401 Authentication failed.

403 No operation permission.

404 No resources found.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 695
Graph Engine Service(GES)
API Reference 8 Out-of-Date APIs

Status Code Description

500 Internal service error.

503 Service unavailable.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 696
Graph Engine Service(GES)
API Reference 9 Appendix

9 Appendix

9.1 Status Codes


Table 9-1 describes status codes.

Table 9-1 Status codes


Stat Message Description
us
Cod
e

100 Continue The client should continue with its request.


This interim response is used to inform the client
that part of the request has been received and has
not yet been rejected by the server.

101 Switching The protocol should be switched. The protocol can


Protocols only be switched to a newer protocol.
For example, the current HTTP protocol is switched
to a later version of HTTP.

201 Created The request has been fulfilled and a new resource
has been created.

202 Accepted The request has been received but has not been
processed.

203 Non-Authoritative The server has successfully processed the request,


Information but is returning information that may be from
another source.

204 NoContent The request has been fulfilled, but the HTTP
response does not contain a response body.
The status code is returned in response to an HTTP
OPTIONS request.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 697
Graph Engine Service(GES)
API Reference 9 Appendix

Stat Message Description


us
Cod
e

205 Reset Content The server has successfully processed the request,
but does not return any content.

206 Partial Content The server has successfully processed the partial
GET request.

300 Multiple Choices There are multiple options for the location of the
requested resource. The response contains a list of
resource characteristics and addresses from which a
user terminal (such as a browser) can choose the
most appropriate one.

301 Moved The requested resource has been assigned a new


Permanently permanent URI, and the new URI is contained in the
response.

302 Found The requested resource resides temporarily under a


different URI.

303 See Other The response to the request can be found under a
different URI.
The response to the request can be found under a
different URI, and should be retrieved using a GET
or POST method.

304 Not Modified The requested resource has not been modified. In
such a case, there is no need to retransmit the
resource since the client still has a previously-
downloaded copy.

305 Use Proxy The requested resource is available only through a


proxy.

306 Unused The HTTP status code is no longer used.

400 BadRequest Invalid request.


The client should modify the request instead of re-
initiating it.

401 Unauthorized This status code is returned after the client provides
the authentication information, indicating that the
authentication information is incorrect or invalid.

402 Payment Required This status code is reserved for future use.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 698
Graph Engine Service(GES)
API Reference 9 Appendix

Stat Message Description


us
Cod
e

403 Forbidden The server has received the request and understood
it, but the server is refusing to respond to it.
The server has received and understood the request;
yet it refused to respond, because the request is set
to deny access. Do not retry the request before
modification.

404 NotFound The requested resource could not be found.


The client should modify the request instead of re-
initiating it.

405 MethodNotAllowe The method specified in the request is not


d supported by the requested resource.
The client should modify the request instead of re-
initiating it.

406 Not Acceptable The server could not fulfill the request according to
the content characteristics of the request.

407 Proxy This code is similar to 401, but indicates that the
Authentication client must first authenticate itself with the proxy.
Required

408 Request Time-out The server timed out waiting for the request.
The client may repeat the request without
modifications at any time later.

409 Conflict The request could not be processed due to a conflict


in the request.
This status code indicates that the resource that the
client is attempting to create already exists, or that
the request has failed to be processed because of
the update of the conflict request.

410 Gone The requested resource cannot be found.


The status code indicates that the requested
resource has been deleted permanently.

411 Length Required The server is refusing to process the request without
a defined Content-Length.

412 Precondition The server does not meet one of the preconditions
Failed that the requester puts on the request.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 699
Graph Engine Service(GES)
API Reference 9 Appendix

Stat Message Description


us
Cod
e

413 Request Entity Too The server is refusing to process a request because
Large the request entity is too large for the server to
process. The server may disable the connection to
prevent the client from sending requests
consecutively. If the server is only temporarily
unable to process the request, the response will
contain a Retry-After header field.

414 Request-URI Too The Request-URI is too long for the server to
Large process.

415 Unsupported The server does not support the media type in the
Media Type request.

416 Requested range The requested range is invalid.


not satisfiable

417 Expectation Failed The server has failed to meet the requirements of
the Expect request-header field.

422 UnprocessableEn- The request was well-formed but was unable to be


tity followed due to semantic errors.

429 TooManyRequests The client has sent excessive number of requests to


the server within a given time (exceeding the limit
on the access frequency of the client), or the server
has received an excessive number of requests within
a given time (beyond its processing capability). In
this case, the client should resend the request after
the time specified in the Retry-After header of the
response has elapsed.

500 InternalServerEr- The server is able to receive the request but unable
ror to understand it.

501 Not Implemented The server does not support the requested function.

502 Bad Gateway The server was acting as a gateway or proxy and
received an invalid request from the remote server.

503 ServiceUnavailable The requested service is invalid.


The client should modify the request instead of re-
initiating it.

504 ServerTimeout The request cannot be fulfilled within a given time.


This status code is returned to the client only when
the Timeout parameter is specified in the request.

505 HTTP Version not The server does not support the HTTP protocol
supported version used in the request.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 700
Graph Engine Service(GES)
API Reference 9 Appendix

9.2 Error Codes

9.2.1 Error Codes for Management Plane APIs


If an error occurs in API calling, no result is returned. Identify the cause of error
based on the error codes of each API. If an error occurs in API calling, HTTP status
code 4xx or 5xx is returned. The response body contains the specific error code
and information. If you fail to locate the cause of the error, contact technical
support and provide the error code for troubleshooting.

Table 9-2 Error codes


Statu Error Error Description Solution
s Code Message
Code

400 GES.0 Incorrect Incorrect 1. Check whether the project


001 parameter. parameter. ID or graph ID in the URL is
correct.
2. Check whether the request
header is correct, for
example, whether X-Auth-
Token is correct.

400 GES.0 Resource not Resource 1. Check whether the project


016 found not found. ID in the URL is the same as
the project ID of the token.
2. Check whether the project
ID in the URL is the same as
the project ID of the graph.

400 GES.7 The graph The graph 1. Call the graph query API to
000 does not exist does not query all graphs.
or has been exist or has 2. Check whether the project
deleted. been ID or graph ID in the URL is
deleted. correct.

400 GES.7 The graph is The graph is 1. Call the graph query API to
001 not running. not running. query all graphs.
2. View the graph list returned
in the preceding step and
check whether the graph
status corresponding to the
graph ID in the URL is 200.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 701
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 The graph is The graph is 1. Call the graph query API to
002 being backed being query all graphs.
up. backed up. 2. View the graph list returned
in the preceding step and
check whether the graph
status corresponding to the
graph ID in the URL is 903.

400 GES.7 The graph is The graph is 1. Call the graph query API to
003 being stopped being query all graphs.
or is stopped. stopped or 2. View the graph list returned
is stopped. in the preceding step and
check whether the graph
status corresponding to the
graph ID in the URL is 900
or 901.

400 GES.7 Components Components Check whether the components


004 at the IaaS at the IaaS at the IaaS layer, such as VPC,
layer are layer are ECS, and OBS, are faulty.
faulty. faulty.

408 GES.7 The The Try again later or contact


005 underlying underlying technical personnel.
service of the service of
graph engine the graph
is unavailable. engine is
unavailable.

400 GES.7 An internal An internal Try again later or contact


006 error occurs error occurs technical support.
in the in the
underlying underlying
service of the service of
graph engine. the graph
engine.

400 GES.7 The job does The job does Check whether the job ID in the
007 not exist. not exist. URL is correct.

400 GES.7 The job is The job is Jobs cannot be stopped


008 stopped. stopped. repeatedly.

400 GES.7 The job The job The job operation is not
009 operation is operation is supported.
not not
supported. supported.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 702
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 Failed to Failed to Check whether the schema file


010 verify the verify the matches the edge and vertex
schema and schema and data files.
data files. data files.

400 GES.7 The path or The path or Check whether the name of the
011 name of the name of the scheme, vertex, or edge data
schema or schema or file is valid. The name can
data file is data file is contain only letters, digits,
invalid. invalid. underscores (_), exclamation
marks (!), hyphens (-), dot
marks (.), asterisks (*), left
brackets, right brackets, and
slashes (/).

400 GES.7 Failed to Failed to Check the graph name. The


012 verify the verify the name contains 4 to 64
graph name. graph name. characters, starting with a
letter. Only letters, digits, and
underscores (_) are supported.

400 GES.7 The graph The graph 1. Call the graph query API to
013 name already name query all graphs.
exists. already 2. Query the graph list
exists. returned in the preceding
step and check whether the
name field in the request
body already exists.

400 GES.7 An error is An error is Check whether the value of


014 reported reported action_id is check-schema.
when the when the
metadata metadata
verification verification
API is called. API is called.

400 GES.7 The graph is The graph is 1. Call the graph query API to
015 not running not running query all graphs.
or is stopped. or is 2. View the graph list returned
stopped. in the preceding step and
check whether the graph
corresponding to the graph
ID in the URL exists or is in
the 900 status.

400 GES.7 The request The request Check the API reference and
016 body or body or ensure that every configuration
header is header is item in the request body and
invalid. invalid. header is correctly configured.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 703
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 The object The object Check whether the schema,
017 does not does not vertex, and edge data files in
exist. Check exist. Check the request body exist on OBS.
whether the whether the
bucket or bucket or
object name object name
is correct. is correct.

400 GES.7 The number The number Call the quota query API to
018 of graphs or of graphs or check whether graphs have
edges reaches edges available quotas.
the upper reaches the
limit. upper limit.

400 GES.7 The number The number Call the quota query API to
019 of graph of graph check whether graph backups
backups backups have available quotas.
reaches the reaches the
upper limit. upper limit.

400 GES.7 The VPC does The VPC Check whether the VPC ID in
020 not exist. does not the request body exists.
exist.

400 GES.7 The subnet The subnet Check whether the subnet ID in
021 cannot be cannot be the request body exists or
found in the found in the belongs to the preceding VPC.
specified VPC. specified
VPC.

400 GES.7 The security The security Check whether the security
022 group does group does group ID in the request body
not exist. not exist. exists.

400 GES.7 The graph The graph Check whether the graph size
023 size index is size index is index in the request body is
invalid. invalid. valid.

400 GES.7 The graph The graph 1. Call the backup query API to
024 backup does backup does query all backups of a
not exist or not exist or specified graph.
has been has been 2. Check whether the backup
deleted. deleted. ID or graph ID in the URL is
correct.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 704
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 Failed to Failed to 1. Assign the security


027 create an create an administrator role to the
agency. agency. user group to which the user
belongs.
2. If the fault persists, report
the error information in
errorMessage to technical
support.

400 GES.7 Failed to Failed to 1. Assign the security


028 authorize an authorize an administrator role to the
agency. agency. user group to which the user
belongs.
2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

400 GES.7 The agency The agency Check whether the agency
029 resource resource resource reaches the quota
exceeds the exceeds the limit on the ManageOne
quota limit. quota limit. operation plane.

400 GES.7 Agency query Agency Check the error message for
030 error. query error. detailed information.

400 GES.7 Invalid Invalid Confirm the EIP binding type.


031 binding type binding type The value can be either of the
of an EIP. of an EIP. following:
● bind_existing

400 GES.7 The EIP The EIP Check whether the EIP resource
032 resource resource reaches the quota limit on the
exceeds the exceeds the VPC page.
quota limit. quota limit.

400 GES.7 Invalid EIP ID. Invalid EIP If the EIP binding type is set to
033 ID. bind_existing, ensure that the
EIP ID exists.

400 GES.7 Invalid region Invalid Enter the correct region code.
035 code. region code.

400 GES.7 The target The target A graph can only be upgraded
036 version is version is to a later version.
earlier than earlier than
the current the current
version. version.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 705
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 The graph is The graph is Check whether the graph is in
037 not in the not in the the Stopped state.
Stopped Stopped
state. state.

400 GES.7 Failed to back Failed to Failed to restore a graph from


040 up a graph. back up a the backup you select.
graph.

400 GES.7 Insufficient Insufficient Insufficient permissions.


041 permission. permissions.

400 GES.7 The graph is The graph is The graph is being created.
042 being created. being
created.

400 GES.7 Invalid graph Invalid Check whether the value of


048 operation. graph action_id is start, stop,
operation. import-graph, export-graph,
clear-graph, or upgrade.

400 GES.7 The The Check whether the request


049 parameter parameter body is consistent with that in
does not does not the API reference. Mandatory
exist. exist. parameters must be set.

400 GES.7 The The Check whether the request


050 parameter is parameter is body is consistent with that in
empty. empty. the API reference. Mandatory
parameters must be set.

400 GES.7 Components Components 1. If the network fluctuates, try


051 at the IaaS at the IaaS again later.
layer are layer are 2. If the fault persists, obtain
faulty. faulty. logs and analyze them for
fault locating.

400 GES.7 Invalid CPU Invalid CPU Check whether the value of
052 architecture architecture arch is set to x86_64 or
of the graph of the graph aarch64 when the graph is
instance. instance. created.

400 GES.7 The graph is The graph is This error occurs in concurrent
054 being deleted being deletion scenarios. Generally, a
or has been deleted or message indicating that the
deleted. has been graph does not exist is
deleted. displayed when you try again
later.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 706
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 The graph of The graph Currently, ten-thousand-edge


056 the current of the and ten-billion-edge graphs
flavor cannot current cannot be scaled out. Check
be scaled out. flavor whether the graph is a ten-
cannot be thousand-edge or ten-billion-
scaled out. edge one.

400 GES.7 Invalid graph Invalid graphSizeTypeIndex in the


057 flavor for graph flavor resize request body can be set
scale-out. for resize. to 2, 3, 4, or 5, indicating the
ten-million-edge, hundred-
million-edge, billion-edge, or
ten-billion-edge graph.

400 GES.7 The IaaS The IaaS Check whether the compute
059 resources of resources of resources are sufficient. For
the graph the graph details about the IaaS resources
flavor to be flavor to be required by each GES flavor, see
scaled out are scaled out the LLD.
insufficient. are
insufficient.

400 GES.7 Failed to Failed to Check whether the compute


061 create the create the resources are sufficient. For
ECS because ECS because details about the IaaS resources
the resources the required by each GES flavor, see
are resources the LLD.
insufficient. are
insufficient.

400 GES.7 Failed to Failed to Check the FusionStorage


062 create the create the capacity or obtain the detailed
data disk. data disk. error information from the
returned errorMessage.

400 GES.7 Failed to Failed to Check the FusionStorage


063 create the create the capacity or obtain the detailed
system disk. system disk. error information from the
returned errorMessage.

400 GES.7 Failed to Failed to See the returned errorMessage


064 create the create the or download the microservice
ECS. ECS. log on the management plane,
search for the ID of failed task
in the log, and contact IaaS
O&M personnel.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 707
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Description Solution


s Code Message
Code

400 GES.7 Failed to Failed to Check whether the image ID


065 query the query the configured on the GES
image image management plane exists.
because the because the
image does image does
not exist. not exist.

400 GES.7 Failed to Failed to Check whether the flavor ID


066 query the query the configured on the GES
flavor. flavor. management plane exists.

400 GES.7 Insufficient Insufficient Check whether the flavor ID


067 ECS quota. ECS quota. configured on the GES
management plane exists.

400 GES.7 Invalid Invalid During graph creation,


068 request request parameters in the request for
parameters. parameters. calling the IaaS API are invalid.
Obtain detailed information
based on the returned error
message for analysis..

400 GES.7 The metadata The The metadata file on OBS or


069 file is too metadata that in the request body
large. file is too exceeds 10 MB.
large.

400 GES.7 Failed to Failed to When creating metadata, the


070 parse the parse the metadata file on OBS or in the
metadata file. metadata request body does not comply
file. with the metadata standards.
Create a metadata file or
request body correctly.

9.2.2 Error Codes for Service Plane APIs


If an error occurs in API calling, no result is returned. Identify the cause of error
based on the error codes of each API. If an error occurs in API calling, HTTP status
code 4xx or 5xx is returned. The response body contains the specific error code
and information. If you fail to locate the cause of the error, contact technical
support and provide the error code for troubleshooting.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 708
Graph Engine Service(GES)
API Reference 9 Appendix

Table 9-3 Error codes


Statu Error Error Message Description Solution
s Code
Code

400 GES.80 Incorrect Incorrect Check whether the request


00 parameter parameter body is the same as that
format. format. described in the document.

400 GES.80 Failed to query Failed to 1. If the network fluctuates,


01 graph statistics. query graph try again later.
statistics. 2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.80 Graph statistics Graph 1. Check whether the token


02 query error. statistics has expired. If it is expired,
query error. obtain a new one.
2. If the fault persists, report
the error information in
errorMessage to technical
support.

400 GES.80 Incorrect Incorrect 1. Check whether the project


05 parameter. parameter. ID in the URL is correct.
2. Check whether the request
header is correct, for
example, whether X-Auth-
Token is correct.

400 GES.80 Invalid Invalid Check whether the project ID


06 resource resource in the URL is correct.
access. access.

400 GES.80 Invalid token. Invalid Check whether the token is


07 token. correct.

400 GES.80 An error occurs An error Try again later or contact


08 in the occurs in the technical support.
underlying underlying
authentication authenticati
system. on system.

400 GES.80 Failed to Failed to 1. Check whether the graph


11 export a graph. export a name is correct.
graph. 2. Check whether the export
path is correct.
3. Check whether the
account has the OBS write
permission.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 709
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.80 Failed to clear Failed to 1. If the network fluctuates,


12 a graph. clear a try again later.
graph. 2. If the fault persists, report
the error information in
errorMessage to technical
support.

400 GES.80 Failed to Failed to 1. If the network fluctuates,


13 incrementally incrementall try again later.
import data to y import 2. If the fault persists, report
the graph. data to the the error information in
graph. errorMessage to technical
support.

400 GES.80 The current The current Grant permissions as the


20 user does not user does first-level VDC Administrator.
have not have the
permission. required
permission
for granular
permission
control.

400 GES.81 Invalid filter Invalid filter Check whether format of the
01 criteria for criteria for filter criteria for edge queries
edge queries. edge is correct.
queries.

400 GES.81 Invalid label Invalid label Check whether the labels are
02 for edge for edge in JSON format.
filtering filtering
queries. queries.

400 GES.81 Both the Both the The condition and label of
03 condition and condition edge filtering queries cannot
label of edge and label of be both empty.
filtering edge
queries are filtering
empty. queries are
empty.

400 GES.81 Invalid edge Invalid edge Check whether the edge
04 filtering query filtering filtering query sequence is
sequence. query valid.
sequence.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 710
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.81 Failed to query Failed to 1. If the network fluctuates,


05 edges that query edges try again later.
meet filter that meet 2. If the fault persists, report
criteria. filter criteria. the error information in
errorMessage to technical
personnel.

400 GES.81 The source The source Ensure that the source vertex
06 vertex or vertex or or target vertex in the edge
target vertex in target vertex details cannot be empty.
the edge in the edge
details is details is
empty. empty.

400 GES.81 Failed to query Failed to 1. If the network fluctuates,


07 edge details. query edge try again later.
details. 2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.81 Edge details Edge details Try again later or contact
08 query error. query error. technical personnel.

400 GES.81 Invalid edge Invalid edge Ensure that the values of
09 filtering query filtering edge filtering query operators
operator. query are in, out, both, and edge.
operator.

400 GES.81 Parameter Parameter Check whether the value of


10 edges cannot edges edges in the batch edge
be left blank. cannot be query request body is empty.
left blank.

400 GES.82 Invalid label Invalid label Check whether the labels are
01 for vertex for vertex in JSON format.
filtering filtering
queries. queries.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 711
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.82 Invalid filter Invalid filter 1. Check whether


02 criteria for criteria for propertyName of the
vertex queries. vertex vertex query API is left
queries. blank.
2. Check whether values of
the vertex query API is left
blank.
3. If the fault persists, report
the error information in
errorMessage to technical
personnel.

400 GES.82 Both the Both the Ensure that the condition and
03 condition and condition label of vertex filtering
label of vertex and label of queries are not both empty.
filtering vertex
queries are filtering
empty. queries are
empty.

400 GES.82 Failed to query Failed to 1. If the network fluctuates,


04 vertices that query try again later.
meet filter vertices that 2. If the fault persists, report
criteria. meet filter the error information in
criteria. errorMessage to technical
personnel.

400 GES.82 Invalid vertex Invalid In the vertex filtering query


05 filtering query vertex API, orderValue must be set
sequence. filtering to incr or decr.
query
sequence.

400 GES.82 Both vertexid Both vertexid and vertextids


06 and vertextids vertexid and cannot coexist.
exist. vertextids
exist.

400 GES.82 Both vertexid Both The vertexid or vertextids


07 and vertextids vertexid and parameter is empty.
are empty. vertextids
are empty.

400 GES.82 Incorrect Incorrect Check whether vertextids is


08 vertextids vertextids a JSON array.
format. format.

400 GES.82 Failed to query Failed to Check whether the graph


09 vertex details. query vertex name exists.
details.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 712
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

500 GES.82 Vertex details Vertex Try again later or contact


10 query error. details query technical personnel.
error.

400 GES.82 Invalid vertex Invalid Ensure that values of vertex


11 filtering query vertex filtering query operators are
operator. filtering inV, outV, bothV, and
query vertex.
operator.

400 GES.82 Failed to delete Failed to Check whether the label


12 the vertex delete the exists.
label. vertex label.

400 GES.82 Failed to add Failed to add Check whether the label
13 the vertex the vertex exists.
label. label.

400 GES.82 Parameter Parameter Check whether the value of


14 vertices cannot vertices vertices in the batch vertex
be left blank. cannot be query request body is empty.
left blank.

400 GES.82 Failed to Failed to 1. If the network fluctuates,


20 update the update the try again later.
vertex vertex 2. If the fault persists, report
properties. properties. the error information in
errorMessage to technical
personnel.

400 GES.82 Failed to Failed to 1. If the network fluctuates,


21 update the update the try again later.
edge edge 2. If the fault persists, report
properties. properties. the error information in
errorMessage to technical
personnel.

400 GES.83 Failed to query Failed to 1. If the network fluctuates,


01 a job. query a job. try again later.
2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.83 Job query error. Job query Try again later or contact
02 error. technical personnel.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 713
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.83 Failed to Failed to 1. If the network fluctuates,


03 terminate a terminate a try again later.
job. job. 2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.83 Job Job Try again later or contact


04 termination termination technical personnel.
error. error.

400 GES.84 The algorithm The Ensure that the algorithm or


01 or graph name algorithm or graph name in not empty.
cannot be graph name
empty. cannot be
empty.

400 GES.84 Failed to run Failed to run 1. If the network fluctuates,


02 the algorithm. the try again later.
algorithm. 2. Check whether the graph
name in the algorithm
running API is correct.
3. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.84 Algorithm Algorithm Try again later or contact


03 running error. running technical personnel.
error.

400 GES.84 Invalid Invalid 1. If the network fluctuates,


04 algorithm algorithm try again later.
running running 2. If the fault persists, report
format. format. the error information in
errorMessage to technical
personnel.

400 GES.85 The Gremlin The Gremlin Replace the unsupported


01 command is command is Gremlin statements: tryNext,
not supported. not explain, and tree.
supported.

400 GES.85 Failed to find Failed to Try again later or contact


02 the Gremlin find the technical personnel.
configuration Gremlin
file. configuratio
n file.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 714
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.85 Gremlin query Gremlin 1. If the network fluctuates,


03 failed. query failed. try again later.
2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

500 GES.85 Gremlin query Gremlin Try again later or contact


04 error. query error. technical personnel.

400 GES.85 The Gremlin The Gremlin Ensure that the Gremlin
05 query query query statement does not
statement does statement contain the command field.
not contain the does not
command contain the
field. command
field.

400 GES.85 The size of the The size of The current limit is 64 MB.
06 Gremlin query the Gremlin
request query
statements request
exceeds the statements
upper limit. exceeds the
upper limit.

500 GES.86 Gremlin service Gremlin Try again later or contact


01 unavailable. service technical personnel.
unavailable.

500 GES.86 Engine service Engine Try again later or contact


02 unavailable. service technical personnel.
unavailable.

400 GES.86 Failed to create Failed to 1. Check whether the index


03 an index create an name contains only letters,
index digits, hyphens (-), and
underscores (_).
2. Check whether the index
parameter type complies
with that specified by the
API.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 715
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.86 Failed to delete Failed to 1. Check whether the graph


04 an index delete an name is correct.
index 2. Check whether the index
name is correct.
3. Check whether Method
type of the request is
delete.

400 GES.86 Failed to query Failed to 1. If the network fluctuates,


05 an index query an try again later.
index 2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

400 GES.86 The request The request 1. Check whether the graph
09 body for body for name is correct.
querying path querying 2. Check whether the
details is path details parameter format of the
invalid. is invalid. API for querying path
details is correct.
3. If the fault persists, report
the error information in
errorMessage to technical
personnel.

400 GES.86 The path The path 1. Check whether the


10 parameter of parameter of parameter format of the
the request the request API for querying path
body for body for details is correct.
querying path querying 2. Check whether the
details is path details mandatory parameters of
invalid. is invalid. the API for querying path
details are set.
3. If the fault persists, report
the error information in
errorMessage to technical
personnel.

400 GES.86 Failed to query Failed to 1. If the network fluctuates,


11 path details. query path try again later.
details. 2. If the fault persists, report
the error information in
errorMessage to technical
personnel.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 716
Graph Engine Service(GES)
API Reference 9 Appendix

Statu Error Error Message Description Solution


s Code
Code

400 GES.86 The operation The 1. If the network fluctuates,


12 of querying operation of try again later.
path details is querying 2. If the fault persists, report
not supported. path details the error information in
is not errorMessage to technical
supported. personnel.

400 GES.88 Failed to add a Failed to add 1. Check whether the label to
01 label to a label to be added already exists.
metadata. metadata. 2. Check whether the format
of the parameter for
adding the label is correct.
3. Check whether the
mandatory parameters for
adding the label are set.

400 GES.88 Failed to query Failed to 1. Check whether the graph


03 the metadata. query the to be queried exists.
metadata. 2. Check whether the value
of graph_name in the API
for querying graph
metadata is correct.

500 GES.88 Metadata Metadata Try again later or contact


04 query error. query error. technical personnel.

400 GES.88 K-Hop query K-Hop query 1. If the network fluctuates,


06 with filter with filter try again later.
criteria failed. criteria 2. If the fault persists, report
failed. the error information in
errorMessage to technical
personnel.

9.3 Obtaining a Project ID


Obtaining a Project ID by Calling an API
You can obtain a project ID by calling an API
The API for obtaining a project ID is GET https://{Endpoint}/v3/projects.
{Endpoint} indicates the endpoint of IAM, which can be obtained from Obtaining
an Endpoint.
For details about API authentication, see Making a Management Plane API
Request.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 717
Graph Engine Service(GES)
API Reference 9 Appendix

The following is an example response. The value of id under projects is the project
ID. The following is an example response. If GES is deployed in the xxx region, the
value of name in the response body is xxx, and the value of id in projects is the
project ID.
{
"projects": [
{
"domain_id": "65382450e8f64ac0870cd180d14e684b",
"is_domain": false,
"parent_id": "65382450e8f64ac0870cd180d14e684b",
"name": "xxx",
"description": "",
"links": {
"next": null,
"previous": null,
"self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99"
},
"id": "a4a5d4098fb4474fa22cd05f897d6b99",
"enabled": true
}
],
"links": {
"next": null,
"previous": null,
"self": "https://www.example.com/v3/projects"
}
}

Obtaining a Project ID from the Console


A project ID is required for some URIs when an API is called.

To obtain a project ID, perform the following operations:

1. Log in to the ManageOne operation plane.


2. Click the username in the upper right corner and choose My Settings from
the drop-down list.
3. On the Resource Sets tab page that is displayed by default, obtain the project
ID.

9.4 Obtaining the Tenant ID


When calling an API, you need to specify the tenant ID (tenant-id) in certain
URLs. To do so, you need to obtain the tenant ID on the management console
first. Perform the following operations to obtain the tenant ID.

1. Log in to ManageOne Operation Portal.


2. Click the username in the upper right corner and choose My Settings from
the drop-down list.
3. On the My Settings page, view Tenant ID.

9.5 Obtaining an Endpoint


The service endpoint consists of the service name, region ID, and external domain
name. The format is service_name.region0_id.external_global_domain_name.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 718
Graph Engine Service(GES)
API Reference 9 Appendix

The service_name indicates the abbreviation of the service name. Perform the
following steps to obtain the values of ges.region0_id and
external_global_domain_name:

Method 1: Using the Environment Parameter File


● region0_id: Search for region0_id on the "1.2 Basic_Parameters" sheet in the
xxx__export_all_v2_EN.xlsx file exported during installation.
● external_global_domain_name: Search for external_global_domain_name on
the "1.2 Basic_Parameters" sheet in the xxx__export_all_v2_EN.xlsx file
exported during base installation.

Method 2: Using ManageOne Operation Portal


Step 1 Log in to ManageOne as an operation administrator using a browser.
● Login URL: https://ManageOne Operation Portal Address, for example,
https://console.demo.com
● Default username: bss_admin. Obtain the default password of the account
from Huawei Cloud Stack 8.3.1 Account List.
The homepage of ManageOne Operation Portal is displayed.
Step 2 In the address box, obtain the value of external_global_domain_name.

Step 3 Choose Resource Statistics > Region to obtain the value of region0_id.

----End

Method 3: Using DMK


Step 1 Log in to DMK.
● In the address box of a browser, enter https://DMK IP address:8443. On the
DMK login page, enter the username and password of the administrator and
click Login.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 719
Graph Engine Service(GES)
API Reference 9 Appendix

● Default username: sysadmin. Obtain the default password of the account


from Huawei Cloud Stack 8.3.1 Account List.

Step 2 In the navigation pane on the left, choose Configurations.

Step 3 In the configuration file, obtain the values of region0_id and


external_global_domain_name. See Figure 9-1 and Figure 9-2.

Figure 9-1 Obtaining the value of external_global_domain_name

Figure 9-2 Obtaining the value of region0_id

----End

After obtaining the service endpoint, you need to add the mapping between the
endpoint and IP address to the system hosts file.

Step 1 Search for reverselb_lvs_agw_float_ip on the "1.2 Basic_Parameters" sheet of the


xxx__export_all_v2_EN.xlsx file exported during installation.

Step 2 Open the C:\Windows\System32\drivers\etc\hosts file and add the mapping


between the endpoint and IP address to the last line of the file.

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 720
Graph Engine Service(GES)
API Reference 9 Appendix

{IP}:{Endpoint}

----End

Issue 01 (2024-04-30) Copyright © Huawei Cloud Computing Technologies Co., Ltd. 721

You might also like