Pinger is a simple tool for checking if a URL is up. It returns a boolean value indicating whether the URL is up or not.
npm install @apiverve/pingershell
npm install @apiverve/pinger
`
Using yarn:
`shell
yarn add @apiverve/pinger
`
---
Configuration
Before using the Domain and IP Pinger API client, you have to setup your account and obtain your API Key.
You can get it by signing up at https://apiverve.com
---
Quick Start
Get started with the Quick Start Guide
The Domain and IP Pinger API documentation is found here: https://docs.apiverve.com/ref/pinger.
You can find parameters, example responses, and status codes documented here.
$3
`javascript
const pingerAPI = require('@apiverve/pinger');
const api = new pingerAPI({
api_key: '[YOUR_API_KEY]'
});
`
---
Usage
---
$3
Using the API is simple. All you have to do is make a request. The API will return a response with the data you requested.
`javascript
var query = {
"host": "google.com",
"retries": 1
};
api.execute(query, function (error, data) {
if (error) {
return console.error(error);
} else {
console.log(data);
}
});
`
---
$3
You can also use promises to make requests. The API returns a promise that you can use to handle the response.
`javascript
var query = {
"host": "google.com",
"retries": 1
};
api.execute(query)
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
`
---
$3
You can also use async/await to make requests. The API returns a promise that you can use to handle the response.
`javascript
async function makeRequest() {
var query = {
"host": "google.com",
"retries": 1
};
try {
const data = await api.execute(query);
console.log(data);
} catch (error) {
console.error(error);
}
}
`
---
Example Response
`json
{
"status": "ok",
"error": null,
"data": {
"host": "google.com",
"numericHost": "2607:f8b0:4001:c1d::64",
"alive": true,
"roundTrips": 3,
"packetLoss": 0,
"minMS": 1.3,
"avgMS": 25.373333333333335,
"maxMS": 72.9,
"stdDev": 33.607381464328476,
"times": [
72.9,
1.3,
1.92
]
}
}
``