Increment and return hits for an id (POST)
curl --request POST \
--url https://nums.advay.ca/hitimport requests
url = "https://nums.advay.ca/hit"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://nums.advay.ca/hit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nums.advay.ca/hit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://nums.advay.ca/hit"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nums.advay.ca/hit")
.asString();require 'uri'
require 'net/http'
url = URI("https://nums.advay.ca/hit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"hits": 123,
"source": "<string>"
}Endpoints
Increment hits (POST)
One of X-Auth-Token header or token query is required.
POST
/
hit
Increment and return hits for an id (POST)
curl --request POST \
--url https://nums.advay.ca/hitimport requests
url = "https://nums.advay.ca/hit"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://nums.advay.ca/hit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nums.advay.ca/hit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://nums.advay.ca/hit"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nums.advay.ca/hit")
.asString();require 'uri'
require 'net/http'
url = URI("https://nums.advay.ca/hit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"hits": 123,
"source": "<string>"
}Increment the counter for an id and return the updated value.
Authentication
Tip
- Send your secret via
X-Auth-Tokenheader or?token=query.
- Use your own deployment URL (e.g.,
https://<project>.vercel.app) and your secret token from the server env (SECRET_TOKEN). - The public instance at
https://nums.advay.cais read-friendly; incrementing requires your own secret.
curl -H "X-Auth-Token: $SECRET_TOKEN" "https://<project>.vercel.app/hit?id=home"
- Viewing counts does not require any token. See
/countand/count.txt.
Headers
Secret token for authentication (required unless token query provided)
Query Parameters
Counter id (default home)
Secret token (alternative to header)
Optional custom deployment URL (defaults to https://nums.advay.ca)