Querying a Subgraph
Function
This API is used to query the subgraphs formed by the entered vertices and edges between the vertices.
URI
POST /ges/v1.0/{project_id}/graphs/{graph_name}/subgraphs/action?action_id=query
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 |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
vertices | Yes | String | Vertex ID array of the subgraph NOTE: The maximum number of vertices that can be entered is 100,000. If the number of vertices exceeds this limit, an error is reported. |
Response Parameters
Parameter | Type | Description |
---|---|---|
errorMessage | String | System prompt.
|
errorCode | String | System prompt code.
|
data | Object | The data field is contained when the query is successful, and the data field contains the subgraph query result. NOTE: The maximum number of subgraph edges that can be returned is 100,000. If the number of edges exceeds this limit, an error is reported. |
Example Request
Query the subgraphs formed by the entered vertices and edges between the vertices. The subgraph vertex IDs are Ray, Ella, and Lethal Weapon.
{"vertices":["Ray","Ella","Lethal Weapon"]}
Example Response
Status code: 200
Example response (successful request)
Http Status Code: 200{"data":{"vertices":[{"id":"Ray","label":"user","properties":{"Name": ["Ray"],"Gender":["M"],"Age":["18-24"],"Occupation":["college/grad student"],"Zip-code":["90241"]}},{"id":"Ella","label":"user","properties":{"Occupation":["other or not specified"],"Name": ["Era"],"Zip-code":["94402"],"Gender":["F"],"Age":["25-34"]}}],"edges":[{"source":"Ray","target":"Lethal Weapon","index":"1","label":"rate","properties":{"Score":[2],"Datetime":["2000-11-22 19:16:16"]}},{"index":"0","source":"Ella","label":"rate","properties":{"Score":[5],"Datetime":["2000-11-23 02:30:29"]},"target":"Lethal Weapon"},{"index":"5","source":"Ella","label":"friends","properties":{},"target":"Ray"}]}}
Status code: 400
Example response for a failed request
Http Status Code: 400{"errorMessage": " Bad Request, parameter vertices cannot be null","errorCode": "GES.8214"}
Status Codes
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 Codes
See Error Codes.
- Function
- URI
- Request Parameters
- Response Parameters
- Example Request
- Example Response
- Status Codes
- Error Codes