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

Executing DSL Algorithms

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 the syntax introduction in DSL Syntax.

URI

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

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For how to obtain a project ID, see Obtaining a Project ID.

graph_name

Yes

String

Graph name

Request Parameters

Table 2 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 3 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.

data

Object

Query results. This parameter is left blank when the query fails.

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
{
     "data":{
         "vertices":[
             {
                 "id":"1",
                 "label":"movie",
                 "properties":{
                     "genres":[
                         "Comedy"
                     ],
                     "movieid":[
                         1
                     ],
                     "title":[
                         "Airplane! (1980)"
                     ]
                 }
             }
         ],
         "runtime":0.126476598
     }
 }

Status code: 400

Example response for a failed request
{  
     "errorCode":"GES.8814",
     "errorMessage":"Unsupported API."
 }

Status Codes

Table 4 Return code for failed requests

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.