Querying Edges That Meet Filter Criteria (1.0.0)
Function
This API is used to query edges that meet filter criteria.
URI
- URI format
POST /ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=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
- Request example
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/edges/action?action_id=query { "offset":"0", "limit":"20", "labels":[ "rate" ], "edgeFilters":[ { "propertyName":"Score", "predicate":">=", "values":[ "2" ] }, { "propertyName":"Datetime", "predicate":"range", "values":[ "1998-12-27 01:00:00", "2000-12-31 00:12:38" ], "type":"or" } ] }
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
labels
Either labels or edgeFilters is mandatory.
String
Filter criteria of the relationship type
edgeFilters
Either labels or edgeFilters is mandatory.
String
Filter criteria, in JSONArray format. Vertices are filtered by property.
offset
No
Integer
Start position of the request
limit
No
Integer
Expected number of edges returned by a query
sorts
No
Json
Result sorting property.
It is in JSONArray format.
Table 3 sorts parameter description Parameter
Mandatory
Type
Description
key
Either Key or propertyName is mandatory.
String
Possible values are label and property, which indicate that labels or properties are sorted.
propertyName
Either Key or propertyName is mandatory.
String
Property name
orderValue
No
String
Possible values are incr and decr, which indicate ascending and descending order respectively. The default value is incr.
Table 4 edgeFilters parameter structure Parameter
Mandatory
Type
Description
propertyName
Yes
String
Property name
predicate
Yes
String
Logical relationship. Possible values are =, <, >, <=, >=, range, has, hasNot, full_text_match, full_text_prefix, full_text_wildcard, full_text_regexp, full_text_fuzzy, and full_text_combination.
values
No
String
Property value. When predicate is full_text_combination, values is not of the string type. For details, see the following note.
type
No
String
Logical relationship of filter criteria. Possible values are and and or. The default value is and.
When predicate is set to full_text_match, full_text_prefix, full_text_wildcard, full_text_regexp, full_text_fuzzy, or full_text_combination, the edgeFilters list can contain only one element, that is, multi-layer filters are not allowed. The labels parameter cannot be used at the same time. When predicate is full_text_combination, set the outermost propertyName to propertyName. In this case, the values parameter is not a simple string list. Each element of the values list has two members: propertyName and value. To use the full-text index, you need to call the API for creating a full-text index first.
Response
| 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. |
| job_id | No | String | ID of the edge query job NOTE: You can view the job execution status and obtain the return result by querying the job ID. For details, see Job Management APIs. |
- Response example (successful request)
Http Status Code: 200 { "jobId": "f9987cab-64d3-4b3d-ac43-e91ae0c21bef168127124", "jobType": 0 } - Response example (failed request)
Http Status Code: 400 { "errorMessage": "Bad Request, parameter labels and edgeFilters cannot all be null", "errorCode": "GES.8103" }
Return Value
- Normal
- Abnormal
Table 6 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.
Last Article: Edge Operation APIs
Next Article: Querying Edge Details (1.0.0)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.