Updated on 2022-02-22 GMT+08:00

Querying Edge Data 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

  • URI format
    POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=batch-query
  • 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

  • Example request
    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"
                }]
    } 
  • Request body parameter description
    Table 2 Request body parameter description

    Parameter

    Mandatory

    Type

    Description

    edges

    Yes

    Json

    Edge array to be queried

    Table 3 edges parameter description

    Parameter

    Mandatory

    Type

    Description

    source

    Yes

    String

    Source vertex of an edge

    target

    Yes

    String

    Target vertex of an edge

    index

    No

    String

    Edge index

Response

  • Parameter description
    Table 4 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

    String

    The data field is contained when the query is successful, and the data field contains the edges query result.

  • Response example of a successful request
    {
        "data": {
            "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"
                }
            ]
        }
    }
  • Response example of a successful request
    {
        "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"
    }
  • Response example (failed request)
    Http Status Code: 400
    {
     "errorMessage":"parameter does not contain 'source'",
     "errorCode":"GES.8000"
    }