GET Get Subscriber Count
This endpoint is used to check subscriber count for a website. The request method of this call needs to be "GET".
Endpoint URL
https://api.webpushr.com/v1/site/subscriber_count
Examples
curl -X GET \
-H "webpushrKey: <YOUR REST API KEY>" \
-H "webpushrAuthToken: <YOUR AUTHENTICATION TOKEN>" \
-H "Content-Type: application/json" \
https://api.webpushr.com/v1/site/subscriber_count
$end_point = 'https://api.webpushr.com/v1/site/subscriber_count';
$http_header = array(
"Content-Type: Application/Json",
"webpushrKey: <YOUR REST API KEY>",
"webpushrAuthToken: <YOUR AUTHENTICATION TOKEN>"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
curl_setopt($ch, CURLOPT_URL, $end_point );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;
import requests
headers = {
'webpushrKey': '<YOUR REST API KEY>',
'webpushrAuthToken': '<YOUR AUTHENTICATION TOKEN>',
'Content-Type': 'application/json',
}
response = requests.get('https://api.webpushr.com/v1/site/subscriber_count', headers=headers)
var request = require('request');
var headers = {
'webpushrKey': '<YOUR REST API KEY>',
'webpushrAuthToken': '<YOUR AUTHENTICATION TOKEN>',
'Content-Type': 'application/json'
};
var options = {
url: 'https://api.webpushr.com/v1/site/subscriber_count',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
extern crate reqwest;
use reqwest::header;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("webpushrKey", "<YOUR REST API KEY>".parse().unwrap());
headers.insert("webpushrAuthToken", "<YOUR AUTHENTICATION TOKEN>".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
let res = reqwest::Client::new()
.get("https://api.webpushr.com/v1/site/subscriber_count")
.headers(headers)
.send()?
.text()?;
println!("{}", res);
Ok(())
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.webpushr.com/v1/site/subscriber_count", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("webpushrKey", "<YOUR REST API KEY>")
req.Header.Set("webpushrAuthToken", "<YOUR AUTHENTICATION TOKEN>")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
Result Format
{
"total_life_time_subscribers":"700",
"active_subscribers":"650",
}
{
"status": "failure",
"type" : "header_invalid",
"description": "Missing webpushrKey in header"
}
{
"status": "failure",
"type" : "bad_request",
"description": "Invalid JSON request"
}
{
"status": "failure",
"type" : "authentication_failure",
"description": "You are not authorized"
}
{
"status": "failure",
"type" : "rate_limit",
"description": "Too many requests"
}
{
"status": "failure",
"description": "Something went wrong. Please try again after some time"
}
{
"status": "failure",
"type": "invalid_value",
"description": "Invalid notification ID"
}