Updated on 2022-08-09 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 (unavailable for 100-billion-edge)
    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"
                }]
    } 
  • Example request (for 100-billion-edge)
    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"
               }
           ]
    }

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

  • 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

    NOTE:

    This parameter is not supported for graphs of the 100-billion-edge type.

    label (for 100-billion-edge)

    No

    String

    Edge label

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.

    result (for 100-billion-edge)

    Yes

    String

    Query result. If the query is successful, the value is success. If the query fails, the value is failed.

  • Response example of a successful request (unavailable for 100-billion-edge)
    {
        "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 (for 100-billion-edge)
    {
        "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"
    }