﻿---
sidebar_position: 1
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get statistics
 Gets the overall community statistics for a period



`Function GetStatistics(Val StartDate, Val EndDate, Val Parameters = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | StartDate | --datefrom | Date | &#x2714; | Start date of the period |
  | EndDate | --dateto | Date | &#x2714; | End date of the period |
  | Parameters | --auth | Structure Of String | &#x2716; | Authorization JSON or path to .json |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from VK

<br/>




```bsl title="1C:Enterprise/OneScript code example"
    Parameters = GetVKParameters();

    CurrentDate = OPI_Tools.GetCurrentDate();
    StartDate   = BegOfDay(CurrentDate);
    EndDate     = EndOfDay(StartDate);

    Result = OPI_VK.GetStatistics(StartDate, EndDate, Parameters);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint vk GetStatistics \
             --datefrom "2024-12-09T00:00:00" \
             --dateto "2024-12-09T23:59:59" \
             --auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint vk GetStatistics ^
             --datefrom "2024-12-09T00:00:00" ^
             --dateto "2024-12-09T23:59:59" ^
             --auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "response": [
  {
   "activity": {
    "comments": 1,
    "likes": 1
   },
   "period_from": 1728432000,
   "period_to": 1728518399,
   "reach": {
    "age": [
     {
      "value": "12-18",
      "count": 0
     },
     {
      "value": "18-21",
      "count": 0
     },
     {
      "value": "21-24",
      "count": 1
     },
     {
      "value": "24-27",
      "count": 0
     },
     {
      "value": "27-30",
      "count": 0
     },
     {
      "value": "30-35",
      "count": 0
     },
     {
      "value": "35-45",
      "count": 0
     },
     {
      "value": "45-100",
      "count": 0
     }
    ],
    "cities": [],
    "countries": [
     {
      "code": "BY",
      "count": 1,
      "name": "Беларусь",
      "value": 3
     }
    ],
    "mobile_reach": 1,
    "reach": 1,
    "reach_subscribers": 1,
    "sex": [
     {
      "value": "f",
      "count": 0
     },
     {
      "value": "m",
      "count": 1
     }
    ],
    "sex_age": [
     {
      "value": "f;12-18",
      "count": 0
     },
     {
      "value": "f;18-21",
      "count": 0
     },
     {
      "value": "f;21-24",
      "count": 0
     },
     {
      "value": "f;24-27",
      "count": 0
     },
     {
      "value": "f;27-30",
      "count": 0
     },
     {
      "value": "f;30-35",
      "count": 0
     },
     {
      "value": "f;35-45",
      "count": 0
     },
     {
      "value": "f;45-100",
      "count": 0
     },
     {
      "value": "m;12-18",
      "count": 0
     },
     {
      "value": "m;18-21",
      "count": 0
     },
     {
      "value": "m;21-24",
      "count": 1
     },
     {
      "value": "m;24-27",
      "count": 0
     },
     {
      "value": "m;27-30",
      "count": 0
     },
     {
      "value": "m;30-35",
      "count": 0
     },
     {
      "value": "m;35-45",
      "count": 0
     },
     {
      "value": "m;45-100",
      "count": 0
     }
    ]
   },
   "visitors": {
    "cities": [],
    "countries": [
     {
      "code": "RU",
      "count": 1,
      "name": "Россия",
      "value": 1
     }
    ],
    "mobile_views": 0,
    "views": 1,
    "visitors": 1
   }
  },
  {
   "activity": {
...
```
