Reputation: 33
Have there been any changes to Google Drive Activity Queries? Today I have noticed that filters don't work properly.
To reply
I upload a file to a drive folder and when I query the activity of that folder the event has much more info and therefore filter's works in a weird way: My params:
{
"ancestorName": "items/Folder_ID",
"filter": "detail.action_detail_case:(MOVE DELETE)"
}
Expected Response
I expect to receive "MOVE" o "DELETE" events, however, I have received the UPLOAD event. In this case, as there has only been one upload I expect:
{
"activities": []
}
Actual Response
{
"activities": [
{
"primaryActionDetail": { "create": { "upload": {} } },
"actors": [ { "user": { "knownUser": { } } } ],
"actions": [
{
"detail": { "create": { "upload": {} } }
},
{
"detail": { "edit": {} }
},
{
"detail": { "permissionChange": { "addedPermissions": [ { } ] } }
},
{
"detail": { "move": { "addedParents": [ { } ] } }
}
],
"targets": [
{
"driveItem": {
}
}
],
"timestamp": "2020-04-15T10:36:58.686Z"
}
]
}
The response has info about each detail that isn't relevant. As can be seen the primaryActionDetail
is "create" "upload" but it is returned in the query despite having queried against "delete"/"move" actions. Any thoughts?
Does this happen because there is a "move" action in "actions"? If so, how could I filter only against primaryActionDetail
?
Upvotes: 1
Views: 442
Reputation: 2998
Migrating Drive API from v1
to v2
, changed how single actions are displayed and grouped in the response. Specifically in v2
, the consolidation strategy does not change the output for DriveActivity whic will always contain the full set of actors, targets, and actions.
A good approach here, as suggested in the documentation, would be filtering for the top level once the API call is returned.
[...] whether or not consolidation is enabled, it may be sufficient for many clients to look at only the top-level contents of a DriveActivity (i.e., the collective Actors and Targets with the primary ActionDetail) and ignore the detailed Actions in the response.
Upvotes: 0