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

Querying Path Details (1.1.6)

Function

This API is used to query the path details. All possible paths will be listed.

URI

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

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

graph_name

Yes

String

Graph name

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
}

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

Request Parameters

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

Response Parameters

Table 3 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 4 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 for a successful request
Http Status Code: 200
{
    "data": {
        "outputs":{
                "paths":[
                    [
                        {
                            "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 for a 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

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.