google-drive-api

How can I filter Google Drive Activity API on permissionChange?


I am using the Google Drive Activity API to query the activity of a team/shared drive.

https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/query?apix_params=%7B%22resource%22%3A%7B%22itemName%22%3A%22items%2FDRIVE_ID%22%2C%22filter%22%3A%22detail.action_detail_case%3ACHANGE%22%7D%7D

The documentation says I can filter by detail.action_detail_case. I am trying to filter on permissionChange activity but I am getting the error:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

I can filter on other activity like detail.action_detail_case:RENAME and detail.action_detail_case:MOVE.


Solution

  • Change:

    {
      "itemName": "items/DRIVE_ID",
      "filter": "detail.action_detail_case:CHANGE"
    }
    

    To:

    {
      "itemName": "items/DRIVE_ID",
      "filter": "detail.action_detail_case:PERMISSION_CHANGE"
    }
    

    Where PERMISSION_CHANGE is the permissionChange from ActionDetail.