FlowGateway Analytics Import Stats API.
Created Nov 12, 2024 at 10:02 PM

Overview

Overview

The documentation pages in this section describe the RESTful APIs included with FlowGateway Product. It is assumed that the reader has practical knowledge of RESTful APIs, so the documentation does not go into detail about what REST is and how to use it. Instead the documentation focuses on what data can be accessed, how to configure and clear it.

The following operations can be performed via the API:

  • Display FlowGateway Analytics based statistics for all client source devices

Details about REST resources can be found in the Resources section. This overview continues with how to run these API's.

Authentication

All REST requests must be authenticated. The Authentication section of the Common API describes which authentication methods are presently supported.

Resources

Settings: Request FlowGateway Analytics Stats using Template Type A

Displays available FlowGateway analytics based stats.

GET https://{device}/api/mgmt.flowgateway_analytics/1.0/import_stats
Authorization

This request requires authorization.

Request Body

Provide a request body with the following structure:

  • JSON
[
  {
    "stats_type": string,
    "interval_type": string,
    "time_interval": number,
    "source_ip": string
  }
]

Example:
{
  "stats_type": "flows_per_minute", 
  "interval_type": "minutes", 
  "time_interval": 60, 
  "source_ip": "10.x.x.x"
}
Property Name Type Description Notes
RequestedStats <array of <object>> FlowGateway Analytics stats request based on last n interval(seconds/minutes/hours/weeks/days/months)
RequestedStats[RequestedStats] <object> Request second/minute/hour based statistics. Optional
RequestedStats[RequestedStats].
stats_type
<string> flows_per_<second/minute/hour>
RequestedStats[RequestedStats].
interval_type
<string> seconds/minutes/hours/weeks/days/months
RequestedStats[RequestedStats].
time_interval
<number> <integer value> without quotes
RequestedStats[RequestedStats].source_ip <string> Enter IPv4/IPv6 address here or leave this string as empty(includes all source devices).
Response Body

On success, the server returns a response body with the following structure:

  • JSON
[
  {
    "time": string,
    "source_ip": string,
    "n_flows": number,
    "n_bytes": number,
    "n_bad_bytes": number,
    "n_packets": number,
    "n_bad_packets": number,
    "peak_n_flows": string,
    "peak_n_bytes": string,
    "peak_n_packets": string
  }
]

Example:
[
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 154, 
    "n_bytes": 8448, 
    "n_bad_bytes": 0, 
    "n_packets": 20, 
    "n_bad_packets": 0, 
    "peak_n_flows": "60", 
    "peak_n_bytes": "3088", 
    "peak_n_packets": "4"
  }, 
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 23677, 
    "n_bytes": 1179508, 
    "n_bad_bytes": 0, 
    "n_packets": 827, 
    "n_bad_packets": 0, 
    "peak_n_flows": "1508", 
    "peak_n_bytes": "75088", 
    "peak_n_packets": "52"
  }
]
Property Name Type Description Notes
DisplayStats <array of <object>> List of FlowGateway analytics based statistics per source device basis or for all source devices.
DisplayStats[DisplayStats] <object> FlowGateway analytics stats per source device or for all source devices. Optional
DisplayStats[DisplayStats].time <string> UTC time
DisplayStats[DisplayStats].source_ip <string> Source device IP address
DisplayStats[DisplayStats].n_flows <number> Total number of flows
DisplayStats[DisplayStats].n_bytes <number> Total number of bytes
DisplayStats[DisplayStats].n_bad_bytes <number> Total number of bad bytes
DisplayStats[DisplayStats].n_packets <number> Total number of packets
DisplayStats[DisplayStats].n_bad_packets <number> Total number of bad packets
DisplayStats[DisplayStats].peak_n_flows <string> Peak value for nflows
DisplayStats[DisplayStats].peak_n_bytes <string> Peak value for nbytes
DisplayStats[DisplayStats].
peak_n_packets
<string> Peak value for npackets

Settings: Request FlowGateway Analytics Stats using Template Type B

Displays available FlowGateway analytics based stats.

GET https://{device}/api/mgmt.flowgateway_analytics/1.0/import_stats
Authorization

This request requires authorization.

Request Body

Provide a request body with the following structure:

  • JSON
[
  {
    "stats_type": string,
    "start_time": string,
    "end_time": string,
    "source_ip": string
  }
]

Example:
{
  "stats_type": "flows_per_minute", 
  "start_time": "23/08/2023 11:36:41", 
  "end_time": "23/08/2023 13:36:41", 
  "source_ip": ""
}
Property Name Type Description Notes
RequestedStats <array of <object>> FlowGateway Analytics stats request based on start time & end time
RequestedStats[RequestedStats] <object> Request second/minute/hour based statistics. Optional
RequestedStats[RequestedStats].
stats_type
<string> flows_per_<second/minute/hour>
RequestedStats[RequestedStats].
start_time
<string> day/month/Year Hour:Minute:Second ex: 23/08/2023 11:36:41
RequestedStats[RequestedStats].end_time <string> day/month/Year Hour:Minute:Second ex: 23/08/2023 13:36:41
RequestedStats[RequestedStats].source_ip <string> Enter IPv4/IPv6 address here or leave this string as empty(includes all source devices).
Response Body

On success, the server returns a response body with the following structure:

  • JSON
[
  {
    "time": string,
    "source_ip": string,
    "n_flows": number,
    "n_bytes": number,
    "n_bad_bytes": number,
    "n_packets": number,
    "n_bad_packets": number,
    "peak_n_flows": string,
    "peak_n_bytes": string,
    "peak_n_packets": string
  }
]

Example:
[
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 154, 
    "n_bytes": 8448, 
    "n_bad_bytes": 0, 
    "n_packets": 20, 
    "n_bad_packets": 0, 
    "peak_n_flows": "60", 
    "peak_n_bytes": "3088", 
    "peak_n_packets": "4"
  }, 
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 23677, 
    "n_bytes": 1179508, 
    "n_bad_bytes": 0, 
    "n_packets": 827, 
    "n_bad_packets": 0, 
    "peak_n_flows": "1508", 
    "peak_n_bytes": "75088", 
    "peak_n_packets": "52"
  }
]
Property Name Type Description Notes
DisplayStats <array of <object>> List of FlowGateway analytics based statistics per source device basis or for all source devices.
DisplayStats[DisplayStats] <object> FlowGateway analytics stats per source device or for all source devices. Optional
DisplayStats[DisplayStats].time <string> UTC time
DisplayStats[DisplayStats].source_ip <string> Source device IP address
DisplayStats[DisplayStats].n_flows <number> Total number of flows
DisplayStats[DisplayStats].n_bytes <number> Total number of bytes
DisplayStats[DisplayStats].n_bad_bytes <number> Total number of bad bytes
DisplayStats[DisplayStats].n_packets <number> Total number of packets
DisplayStats[DisplayStats].n_bad_packets <number> Total number of bad packets
DisplayStats[DisplayStats].peak_n_flows <string> Peak value for nflows
DisplayStats[DisplayStats].peak_n_bytes <string> Peak value for nbytes.
DisplayStats[DisplayStats].
peak_n_packets
<string> Peak value for npackets

Settings: Request FlowGateway Analytics Stats using Template Type C

Displays available FlowGateway analytics based stats.

GET https://{device}/api/mgmt.flowgateway_analytics/1.0/import_stats
Authorization

This request requires authorization.

Request Body

Provide a request body with the following structure:

  • JSON
[
  {
    "stats_type": string,
    "start_time": number,
    "end_time": number,
    "source_ip": string
  }
]

Example:
{
  "stats_type": "flows_per_minute", 
  "start_time": 1702580400, 
  "end_time": 1702584000, 
  "source_ip": ""
}
Property Name Type Description Notes
RequestedStats <array of <object>> FlowGateway Analytics stats request based on epoch start time & end time
RequestedStats[RequestedStats] <object> Request second/minute/hour based statistics. Optional
RequestedStats[RequestedStats].
stats_type
<string> flows_per_<second/minute/hour>
RequestedStats[RequestedStats].
start_time
<number> epoch time as an <integer value> without quotes.
RequestedStats[RequestedStats].end_time <number> epoch time as an <integer value> without quotes.
RequestedStats[RequestedStats].source_ip <string> Enter IPv4/IPv6 address here or leave this string as empty(includes all source devices).
Response Body

On success, the server returns a response body with the following structure:

  • JSON
[
  {
    "time": string,
    "source_ip": string,
    "n_flows": number,
    "n_bytes": number,
    "n_bad_bytes": number,
    "n_packets": number,
    "n_bad_packets": number,
    "peak_n_flows": string,
    "peak_n_bytes": string,
    "peak_n_packets": string
  }
]

Example:
[
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 154, 
    "n_bytes": 8448, 
    "n_bad_bytes": 0, 
    "n_packets": 20, 
    "n_bad_packets": 0, 
    "peak_n_flows": "60", 
    "peak_n_bytes": "3088", 
    "peak_n_packets": "4"
  }, 
  {
    "time": "2024-01-08 22:11:00+00:00", 
    "source_ip": "10.x.x.x", 
    "n_flows": 23677, 
    "n_bytes": 1179508, 
    "n_bad_bytes": 0, 
    "n_packets": 827, 
    "n_bad_packets": 0, 
    "peak_n_flows": "1508", 
    "peak_n_bytes": "75088", 
    "peak_n_packets": "52"
  }
]
Property Name Type Description Notes
DisplayStats <array of <object>> List of FlowGateway analytics based statistics per source device basis or for all source devices.
DisplayStats[DisplayStats] <object> FlowGateway analytics stats per source device or for all source devices. Optional
DisplayStats[DisplayStats].time <string> UTC time
DisplayStats[DisplayStats].source_ip <string> Source device IP address
DisplayStats[DisplayStats].n_flows <number> Total number of flows
DisplayStats[DisplayStats].n_bytes <number> Total number of bytes
DisplayStats[DisplayStats].n_bad_bytes <number> Total number of bad bytes
DisplayStats[DisplayStats].n_packets <number> Total number of packets
DisplayStats[DisplayStats].n_bad_packets <number> Total number of bad packets
DisplayStats[DisplayStats].peak_n_flows <string> Peak value for nflows
DisplayStats[DisplayStats].peak_n_bytes <string> Peak value for nbytes.
DisplayStats[DisplayStats].
peak_n_packets
<string> Peak value for npackets

Error Codes

In the event that an error occurs while processing a request, the server will respond with appropriate HTTP status code and additional information in the response body:

{
     "error_id":   "{error identifier}",
     "error_text": "{error description}",
     "error_info": {error specific data structure, optional}
}

The table below lists the possible errors and the associated HTTP status codes that may returned.

Error ID HTTP Status Comments
BAD_REQUEST 400 Invalid argument.
AUTH_REQUIRED 401 Authentication required.
AUTH_INVALID_CREDENTIALS 401 Make sure the user name is correct and type your password again. Be sure to use the correct case for the user name and password.
HTTP_INVALID_METHOD 405 Requested method is not available for this resource.
INTERNAL_ERROR 500 Internal error.