0

I really hope you can help me out with this. I am trying a basic operation but I am not able to find enough details on the documentation. So my goal is to get the clicks summary of a Bitly link but i am getting the following error :

{'message': 'UPGRADE_REQUIRED', 'resource': 'bitlinks', 'description': 'Metrics request exceeds maximum queryable date range.'}

Here is my code:

import requests
headers = {
    'Authorization': 'Bearer {TOKEN}',
}

params = (
    ('unit', 'month'),
    ('units', '5'),
    ('size', '10'),
    ('unit_reference', '2006-01-02T15:04:05-0700'),
)

response = requests.get('https://api-ssl.bitly.com/v4/bitlinks/bit.ly/3kaLPVY/clicks/summary', headers=headers, params=params)
print(response.json())

I am not familiar with HTTP requests on Python so I don't know how to solve this issue.

NB : I have replaced {TOKEN} with my key.

1 Answers1

1

I have found a solution and I am answering here so others could get help from it :

response = requests.get('https://api-ssl.bitly.com/v4/bitlinks/bit.ly/3kaLPVY/clicks/summary', headers=headers, params=params)

should be replaced by

response = requests.get('https://api-ssl.bitly.com/v4/bitlinks/bit.ly/3kaLPVY/clicks/summary', headers=headers)

Apparently, no parameters are needed except the authorization key (token).