Flow Count
This endpoint returns the number of flow observations matching the specified criteria.
POST /openapi/v1/flowsearch/count
Parameters:
The body of the request should be a JSON formatted query. An example of a query body is shown below. Parameters t0
and t1
in the request body can be in epoch format or in ISO 8601 format. This API only allows querying maximum time range of one day. In addition, you need to specify the scopeName
parameter which is the full name of the scope to which you want to restrict the search. If this parameter is not specified, flow observation count API request applies to all scopes to which you have read access. The filter
is same as that of filter of Flow Search Filters
.
{
"t0": "2016-06-17T09:00:00-0700", # t0 can also be 1466179200
"t1": "2016-06-17T17:00:00-0700", # t1 can also be 1466208000
"filter": {"type": "eq", "field": "src_address", "value": "172.29.203.193"},
"scopeName": "Default"
}
The query body consists of a JSON body with the following keys.
Keys |
Values |
---|---|
t0 |
Start time of the flow (epoch or ISO 8601) |
t1 |
End time of the flow (epoch or ISO 8601) |
filter |
Query filter. If filter is empty (i.e. {}) then query matches all flows. |
scopeName |
Full name of the scope to which query is restricted to |
Response object:
Keys |
Values |
---|---|
count |
The number of flow observations matching the flow search criteria. |
Sample python code
req_payload = {
"t0": "2017-07-20T08:20:00-07:00",
"t1": "2017-07-20T10:20:00-07:00",
"scopeName": "Tetration",
"filter": {
"type": "eq",
"field": "dst_port",
"value": "5642"
}
}
resp = rc.post('/flowsearch/count',
json_body=json.dumps(req_payload))
print resp.status_code
if resp.status_code == 200:
parsed_resp = json.loads(resp.content)
print json.dumps(parsed_resp)
Sample response
{"count":508767}