Get itemAnalytics

Namespace: microsoft.graph

Get itemAnalytics about the views that took place under this resource. The itemAnalytics resource is a convenient way to get activity stats for allTime and the lastSevenDays. For a custom time range or interval, use the getActivitiesByInterval API.

Note: The itemAnalytics resource is not yet available in all national deployments.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
Delegated (personal Microsoft account) Not supported.
Application Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All

HTTP request

GET /drives/{drive-id}/items/{item-id}/analytics/allTime
GET /sites/{site-id}/analytics/allTime
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/analytics/allTime
GET /drives/{drive-id}/items/{item-id}/analytics/lastSevenDays
GET /sites/{site-id}/analytics/lastSevenDays
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/analytics/lastSevenDays

Optional query parameters

This method supports the OData query parameters to help customize the response.

Request headers

Name Description
Authorization Bearer {code}. Required.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a collection of itemAnalytics objects in the response body.

Example

Request

The following is an example of a request.

GET /drives/{drive-id}/items/{item-id}/analytics/allTime

Response

The following is an example of the response.

HTTP/1.1 200 OK
Content-type: application/json

{
    "allTime": {
        "access": {
            "actionCount": 123,
            "actorCount": 89
        }
    }
}