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

Querying General Information About a Graph

Function

This API is used to query the general information about a graph, such as the numbers of vertices and edges.

URI

  • URI format
    GET /ges/v1.0/{project_id}/graphs/{graph_name}/summary?label_details={labelDetails}
  • 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

    labelDetails

    No

    Boolean

    Whether to return the number of vertices and edges under each label. The default value is false. If this parameter is set to true, the numbers of vertices and edges under each label are returned.

Request

  • Request example
    GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/summary?label_details=true

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

Response

Table 2 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 request fails.

Table 3 data parameter description

Parameter

Mandatory

Type

Description

vertexNum

Yes

Integer

Number of vertices in a graph

edgeNum

Yes

Integer

Number of edges in a graph

labelDetails

Yes

Json

Numbers of vertices and edges under each label. To properly display this parameter, create vertex and edge indexes based on Table 4.

Table 4 Description of each element in labelDetails when the execution is successful

Parameter

Mandatory

Type

Description

labelInVertex

No

Json

Number of vertices under each label. If the number of vertices under a label is 0, the label is not displayed.

To include this parameter in the response, create an index by referring to Creating an Index. During index creation, set indexType to GlobalCompositeVertexIndex, set hasLabel to true, and leave indexProperty blank.

labelInEdge

No

Json

Number of edges under different labels. If the number of edges under a label is 0, the label is not displayed.

To include this parameter in the response, create an index by referring to Creating an Index. During index creation, set indexType to GlobalCompositeEdgeIndex, set hasLabel to true, and leave indexProperty blank.

errorMessage

No

String

System prompt. If execution succeeds, this parameter is left blank. If execution fails, this parameter is used to display the error message.

errorCode

No

String

System prompt. If execution succeeds, this parameter is left blank. If execution fails, this parameter is used to display the error code.

  • Response example 1 of a successful request (The numbers of vertices and edges under each label are returned.)
    Http Status Code: 200
    {
        "data": {
            "vertexNum": 146,
            "labelDetails": {
                "labelInVertex": {
                    "movie": 46,
                    "user": 100
                },
                "labelInEdge": {
                    "default": 450,
                    "rate": 1209
                }
            },
            "edgeNum": 1659
        }
    }
  • Response example 2 of a successful request (The numbers of vertices and edges under each label fail to be returned.)
    Http Status Code: 200
    {
        "data": {
            "vertexNum": 146,
            "labelDetails": {
                "errorMessage": "Label index in vertices is not found.Label index in edges is not found.",
                "errorCode": "GES.8017"
            },
            "edgeNum": 1659
        }
    }
  • Example response 3 of a successful request (Only the number of vertices under each label is returned.)
    Http Status Code: 200
    {
      {
        "data": {
            "vertexNum": 146,
            "labelDetails": {
                "errorMessage": "Label index in edges is not found.",
                "labelInVertex": {
                    "movie": 46,
                    "user": 100
                },
                "errorCode": "GES.8017"
            },
            "edgeNum": 1659
        }
    }
  • Example response of a successful request
    Http Status Code: 200
    {
    "jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232"
    }
  • Example response of a failed request
    Http Status Code: 400
    {
        "errorMessage": "graph [demo] is not found",
        "errorCode": "GES.8001"
    }

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.