Get Short Link Metrics by Country

POST /api/v1/analytics

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

The createQrCodeHandler creates a qr code for the input body and returns the reponse to users

Request

Method : POST
Content-Type : Application/json

URL Parameters Schema

shortlink string Required
Default: N/A
The URL to analyze (e.g., "https://kut.lt/d3i1t")
startDate string Required
Default: N/A
Start date in YYYY-MM-DD format
endDate string Required
Default: N/A
End date in YYYY-MM-DD format
plan string Required
Default: N/A
User's plan type ("STARTER", "STANDARDRD", "SUPER".)
linkAnalytics number
Default: null
Limit number of analytics entries
kind string Required
Default: null
country
LANGUAGE
REQUEST
 curl -X POST \

	  'https://apis.divsly.com/api/v1/analytics' \

	  -H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE' \

	  -H 'Content-Type: application/json' \

	  -d '{

		"shortlink": "https://kut.lt/d3i1t?r=qr",

		"startDate": "2024-03-01",

		"endDate": "2024-03-25",

		"plan": "STARTER",

		"linkAnalytics": 5,

		"kind": "country"

	  }'

API REQUEST
 fetch('https://apis.divsly.com/api/v1/analytics', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    shortlink: 'https://kut.lt/d3i1t?r=qr',
    startDate: '2024-03-01',
    endDate: '2024-03-25',
    plan: 'STARTER',
    linkAnalytics: 5,
    kind: 'country'
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
                    
API REQUEST
 const axios = require('axios');

axios.post(
  'https://apis.divsly.com/api/v1/analytics',
  {
    shortlink: 'https://kut.lt/d3i1t?r=qr',
    startDate: '2024-03-01',
    endDate: '2024-03-25',
    plan: 'STARTER',
    linkAnalytics: 5,
    kind: 'country'
  },
  {
    headers: {
      Authorization: 'Bearer YOUR_JWT_TOKEN_HERE',
      'Content-Type': 'application/json'
    }
  }
)
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error(error.response?.data || error.message);
});

API REQUEST
 $curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://apis.divsly.com/api/v1/analytics',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_JWT_TOKEN_HERE',
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'shortlink' => 'https://kut.lt/d3i1t?r=qr',
        'startDate' => '2024-03-01',
        'endDate' => '2024-03-25',
        'plan' => 'STARTER',
        'linkAnalytics' => 5,
        'kind' => 'country'
    ])
]);

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error: ' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);

API REQUEST
 import requests

url = "https://apis.divsly.com/api/v1/analytics"

payload = {
    "shortlink": "https://kut.lt/d3i1t?r=qr",
    "startDate": "2024-03-01",
    "endDate": "2024-03-25",
    "plan": "STARTER",
    "linkAnalytics": 5,
    "kind": "country"
}

headers = {
    "Authorization": "Bearer YOUR_JWT_TOKEN_HERE",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.status_code)
print(response.json())

RESPONSE
  {
    "message": "Analytics fetched successfully",
    "success": true,
    "resultData": {
      "country": [
        {
          "country": "United States",
          "_count": {
            "_all": 150,
            "country": 150
          }
        },
        {
          "country": "India",
          "_count": {
            "_all": 85,
            "country": 85
          }
        }
      ]
    }
}
        
  {
	"message": "Unauthorized!"
}

 {
	"message": "Quota not found.!"
}

    
 { 
    "message": "Internal server error."
 }