Code snippet to get general metrics


I’m attempting to accomplish a relatively straightforward task, but as someone without a programming background, I’m encountering some difficulties. It’s possible that I haven’t yet located the appropriate documentation. Here’s what I’m currently doing in my small Python script to gather general metrics about my Matomo usage:

url = f'{BASE_URL}/?module=API&method=Actions.get&idSite={IDSITE}&period={PERIOD}&date={DATE}&format={FORMAT}&token_auth={TOKEN}&filter_limit={LIMIT}' 
response = requests.get(url)  

And I get by default those metrics :
nb_pageviews, nb_uniq_pageviews, nb_downloads, nb_uniq_downloads, nb_outlinks, nb_uniq_outlinks, nb_searches, nb_keywords

However I would like this ones :
nb_uniq_visitors, nb_visits, nb_users, sum_visit_length, bounce_count, nb_pageviews, nb_uniq_pageviews

Could you please provide guidance on how to select the metrics to extract from the API?

Thanks for your help

Hi @Pierre_Hellich
For the detailed API description, have a look there: