# Statistics

#### Get Interface Counters

| **Request URL**   | api/info/opbport/stats                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Description**   | Use this API to get abridged port statistics.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **Method**        | GET                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Request Body**  | NA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **Response Body** | <p>{"Ethernet1\_1": {"IF\_IN\_OCTETS": 0, "IF\_IN\_UCAST\_PKTS": 0, "IF\_IN\_NON\_UCAST\_PKTS": 0, "IF\_IN\_DISCARDS": 0, "IF\_IN\_ERRORS": 0, "IF\_OUT\_OCTETS": 0, "IF\_OUT\_UCAST\_PKTS": 0, "IF\_OUT\_NON\_UCAST\_PKTS": 0, "IF\_OUT\_DISCARDS": 0, "IF\_OUT\_ERRORS": 0, "IF\_IN\_MULTICAST\_PKTS": 0, "IF\_OUT\_MULTICAST\_PKTS": 0}, "Ethernet2\_1": </p><p><.........> </p><p>"Ethernet22\_1": {"IF\_IN\_OCTETS": 0, "IF\_IN\_UCAST\_PKTS": 0, "IF\_IN\_NON\_UCAST\_PKTS": 0, "IF\_IN\_DISCARDS": 0, "IF\_IN\_ERRORS": 0, "IF\_OUT\_OCTETS": 0, "IF\_OUT\_UCAST\_PKTS": 0, "IF\_OUT\_NON\_UCAST\_PKTS": 0, "IF\_OUT\_DISCARDS": 0, "IF\_OUT\_ERRORS": 0, "IF\_IN\_MULTICAST\_PKTS": 0, "IF\_OUT\_MULTICAST\_PKTS": 0}}</p> |
| **Status code**   | <ul><li>SERVER\_ERROR(500) if there is any error with the server</li><li>OK(200) if the request completes successfully</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

#### **Get Interface Counters <**&#x65;th\_nam&#x65;**>**

| **Request URL**   | api/info/opbport/stats/\<eth\_name>                                                                                                                                                                                                                                                                                                       |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Description**   | Use this API to get abridged port statistics for specific port.                                                                                                                                                                                                                                                                           |
| **Method**        | GET                                                                                                                                                                                                                                                                                                                                       |
| **Request Body**  | NA                                                                                                                                                                                                                                                                                                                                        |
| **Response Body** | {"Ethernet12\_1": {"IF\_IN\_OCTETS": 0, "IF\_IN\_UCAST\_PKTS": 0, "IF\_IN\_NON\_UCAST\_PKTS": 0, "IF\_IN\_DISCARDS": 0, "IF\_IN\_ERRORS": 0, "IF\_OUT\_OCTETS": 0, "IF\_OUT\_UCAST\_PKTS": 0, "IF\_OUT\_NON\_UCAST\_PKTS": 0, "IF\_OUT\_DISCARDS": 0, "IF\_OUT\_ERRORS": 0, "IF\_IN\_MULTICAST\_PKTS": 0, "IF\_OUT\_MULTICAST\_PKTS": 0}} |
| **Status code**   | <ul><li>SERVER\_ERROR(500) if there is any error with the server</li><li>OK(200) if the request completes successfully</li></ul>                                                                                                                                                                                                          |

#### **Get Flow rule counters**

| **Request URL**   | /api/info/flows/\<flow-name>/rules/\<rule-id>/statistics                                                                                 |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Description**   | Use this API to get the statistics details for the specified flow and rule.                                                              |
| **Method**        | GET                                                                                                                                      |
| **Request Body**  | NA                                                                                                                                       |
| **Response Body** | <p>{ </p><p>"map\_name": "flow1", </p><p>"ASIC-Stat-Id": "27", </p><p>"rule\_id": "1", </p><p>"Total-packets-mirrored": "0" </p><p>}</p> |
| **Status code**   | <ul><li>SERVER\_ERROR(500) if there is any error with the server</li><li>OK(200) if the request completes successfully</li></ul>         |

#### **Clear Flow counters**

| **Request URL**   | /api/config/stats/clear/all   or /api/config/stats/clear/flows/flow1   or /api/config/stats/clear/flows/flow1/rules/10                |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **Description**   | Use this API to clear the opb flow/rule/all counters                                                                                  |
| **Method**        | POST                                                                                                                                  |
| **Request Body**  | NA                                                                                                                                    |
| **Response Body** | NA                                                                                                                                    |
| **Status code**   | <p></p><ul><li>SERVER\_ERROR(500) if there is any error with the server</li><li>OK(200) if the request completes successful</li></ul> |

#### **Clear interface counters**

| **Request URL**   | /api/interfaces/config/stats/clear                                                                                               |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Description**   | Use this API to clear the interface counters                                                                                     |
| **Method**        | POST                                                                                                                             |
| **Request Body**  | NA                                                                                                                               |
| **Response Body** | NA                                                                                                                               |
| **Status code**   | <ul><li>SERVER\_ERROR(500) if there is any error with the server</li><li>OK(200) if the request completes successfully</li></ul> |
