Updated on 2022-08-09 GMT+08:00

Querying Path Details

Function

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

URI

  • URI format
    POST /ges/v1.0/{project_id}/graphs/{graph_name}/paths/action?action_id=query-detail
  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details, see Obtaining a Project ID.

    graph_name

    Yes

    String

    Graph name

Request

  • Request example
    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 Constraints of Using Service Plane APIs.

Table 2 Request body parameter description

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

Table 3 Parameter description

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.

data

No

Json

Query results.

This parameter is left blank when the query fails.

Table 4 data parameter description

Parameter

Type

Description

outputs

Json

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": []}.

  • Response example (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"]
                                }
                            }
                        ]
                    ]
              }
        }
    }
  • Response example (failed request)
    Http Status Code: 400
    {
    "errorMessage":"graph [demo] is not found",
    "errorCode":"GES.8107"
    }

Return Value

  • Normal

    200

  • Abnormal
    Table 5 Return code for failed requests

    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.