# Explorer v2 API

The `Explorer API` basically serves the same purpose as the `HTTP API`, but the difference is the data that Explorer API returns is more presentable and complete, while the `HTTP API` is more suited in terms of fetching individual data items.

There is also a minor difference in the way the two APIs communicate with the nodes to fetch the on-chain data.

It is recommended that the HTTP API be used when initiating and transmitting transactions to the chain.

The `Explorer API` also with a online platform that can fetch transaction related information using the web browser. It works with the transaction that have taken place on both the `testnet` and the `mainnet`. The website can be accessed using this link - <https://explorer.ont.io/>

## Query Format

### URL Request Parameter Specification

#### Multiple URL parameters are connected using underscores

`/v2/blocks?page_size=10&page_number=1`

* **Page Parameters**

|   Parameter  | Description                          |
| :----------: | ------------------------------------ |
|  page\_size  | Number of records per page \[1 - 20] |
| page\_number | Total number of pages \[ >= 1 ]      |

* **Time Parameters**

|  Parameter  | Description                 |
| :---------: | --------------------------- |
| start\_time | Start time (UNIX timestamp) |
|  end\_time  | End time (UNIX timestamp)   |

{% hint style="info" %}
The maximum valid time range is **one week.**
{% endhint %}

### Response Codes

#### HTTP Status Codes

|         Status Code         | Description                                                               |
| :-------------------------: | ------------------------------------------------------------------------- |
|     200 (Normal Request)    | Successful response                                                       |
|      400 (Bad Request)      | Server could not process the request, likely due to an invalid parameters |
| 500 (Internal Server Error) | Unexpected server issue                                                   |

#### Response DTO

The response **DTO** is a status object that is always included in the JSON response payload for both successful and failed calls. When errors occur you may refer to the `code` and `msg` fields that are part of the status object.

```javascript
{
  "code": 0, // 0 implies successful calls, !=0 implies failure
  "msg": "SUCCESS",
  "result": {}
}
```
