Am a keen follower of Microsoft's SharePoint Blog and proud to provide this direct from the Microsoft Tech Community:
Making calls with just analytics endpoint /sites/{site-id}/lists/{list-id}/items/{item-id}/analytics will return null data as shown below:
{‘@odata.context’: ‘https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.itemAnalytics‘,
‘allTime’: None,
‘lastSevenDays’: None}
Please make calls and request ‘alltime‘ and ‘lastsevendays‘ separately as shown below:
- /sites/{site-id}/lists/{list-id}/items/{item-id}/analytics/alltime
- /sites/{site-id}/lists/{list-id}/items/{item-id}/analytics/lastsevendays
Step 1: Retrieve all the internal SharePoint ids of the all Pages in the “Site Pages”
Sample Output:
{
“@odata.etag”: “”6967cfed-0000-0000-0000-b480c1764375,3″”,
“sharepointIds”: {
“listItemId”: “1”,
“listItemUniqueId”: “6967cfed-0000-0000-0000-b480c1764375“,
“siteId”: “df6ba610-0000-0000-0000-ba2733d0182e”,
“tenantId”: “d6f932a7-0000-00000-0000-b27004970776”,
“webId”: “e0dbcdc6-0000-0000-0000-49aaa1ce4d37”
}
},
Step 2: Select any Pages “listItemUniqueId” retrieved in Step 1 and make following call:
Data returned below:
{
“aggregationInterval”: “None”,
“startDateTime”: “0001-01-01T00:00:00Z”,
“endDateTime”: “0001-01-01T00:00:00Z”,
“isTrending”: false,
“access”: {
“actionCount“: 345,
“actorCount“: 6,
“timeSpentInSeconds”: 0
},
“incompleteData”: {
“missingDataBeforeDateTime”: “2018-09-21T19:20:43Z”,
“wasThrottled”: false,
“resultsPending”: false,
“notSupported”: false
},
“activities”: [
{
“id”: “00000”,
“activityDateTime”: “2021-04-12T17:59:12Z”,
“location”: {
“address”: {
“city”: “”,
“countryOrRegion”: “”,
“postalCode”: “”,
“state”: “”,
“street”: “”
}
},
“access”: {},
“actor”: {
“user”: {
“displayName”: “Admin SPOTenant”,
“email”: “admin@spotenant.onmicrosoft.com”,
“id”: “faaa2e55-0000-0000-0000-c774a83bbbde”,
“userType”: “Internal”
}
}
},
{
“id”: “00001”,
“activityDateTime”: “2020-12-12T01:03:30Z”,
“location”: {
“address”: {
“city”: “”,
“countryOrRegion”: “”,
“postalCode”: “”,
“state”: “”,
“street”: “”
}
},
“access”: {},
“actor”: {
“user”: {
“displayName”: “Alex Darrow”,
“email”: “alexd@spotenant.onmicrosoft.com”,
“id”: “e81cac19-0000-0000-0000-4c938b101a33”,
“userType”: “Internal”
}
}
}
]
}
The above is kindly provided by the Microsoft Tech Community!