taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
714 stars 87 forks source link

Vault counts for Drive corpus fails with 400 Bad Request #238

Closed jay-eleven closed 2 years ago

jay-eleven commented 2 years ago

When requesting a Vault count for corpus drive, gam fails with ERROR: 400: invalidArgument - Corpus type DRIVE is not supported.

Redacted trace logs:

$ gam config debug_level 1 print vaultcounts matter test corpus drive accounts a@d.com
connect: (vault.googleapis.com, 443)
send: b'GET /$discovery/rest?version=v1 [...]
reply: 'HTTP/1.1 200 OK\r\n'
send: b'GET /v1/matters?view=BASIC [...]
reply: 'HTTP/1.1 200 OK\r\n'
send: b'POST /v1/matters/xx:count?prettyPrint=true&alt=json [...]
send: b'{"view": "ALL", "query": {"dataScope": "ALL_DATA", "corpus": "DRIVE", "searchMethod": "ACCOUNT", "accountInfo": {"emails": ["a@d.com"]}}}'
reply: 'HTTP/1.1 400 Bad Request\r\n'

ERROR:  JSON: {'error': {'code': 400, 'message': 'Corpus type DRIVE is not supported.', 'status': 'INVALID_ARGUMENT'}}
ERROR: 400: invalidArgument - Corpus type DRIVE is not supported.

Gam documentation says:

The required argument corpus specifies whether Gmail mailbox data or Google Groups archives are queried.

But gam's command syntax says:

gam print vaultcounts [todrive <ToDriveAttributes>*]
        matter <MatterItem> corpus drive|mail|groups|hangouts_chat|voice

The drive corpus is indeed supported when exporting from Vault.

There's no indication in the reference documentation that drive is not supported when counting: https://developers.google.com/vault/reference/rest/v1/matters/count https://developers.google.com/vault/reference/rest/v1/Query

Some kind of bug on their end?

taers232c commented 2 years ago

Jay,

I don't see anything obvious; is there an admin console way to do the same thing; is there any clue there?

Ross

On Fri, Feb 4, 2022 at 6:57 AM Jay @.***> wrote:

When requesting a Vault count for corpus drive, gam fails with ERROR: 400: invalidArgument - Corpus type DRIVE is not supported.

Redacted trace logs:

$ gam config debug_level 1 print vaultcounts matter test corpus drive accounts @. connect: (vault.googleapis.com, 443) send: b'GET /$discovery/rest?version=v1 [...] reply: 'HTTP/1.1 200 OK\r\n' send: b'GET /v1/matters?view=BASIC [...] reply: 'HTTP/1.1 200 OK\r\n' send: b'POST /v1/matters/xx:count?prettyPrint=true&alt=json [...] send: b'{"view": "ALL", "query": {"dataScope": "ALL_DATA", "corpus": "DRIVE", "searchMethod": "ACCOUNT", "accountInfo": {"emails": @."]}}}' reply: 'HTTP/1.1 400 Bad Request\r\n'

ERROR: JSON: {'error': {'code': 400, 'message': 'Corpus type DRIVE is not supported.', 'status': 'INVALID_ARGUMENT'}} ERROR: 400: invalidArgument - Corpus type DRIVE is not supported.

Gam documentation says:

The required argument corpus specifies whether Gmail mailbox data or Google Groups archives are queried.

But gam's command syntax says:

gam print vaultcounts [todrive *] matter corpus drive|mail|groups|hangouts_chat|voice

The drive corpus is indeed supported when exporting from Vault.

There's no indication in the reference documentation that drive is not supported when counting: https://developers.google.com/vault/reference/rest/v1/matters/count https://developers.google.com/vault/reference/rest/v1/Query

Some kind of bug on their end?

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/238, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL37AEAGNGEXVXBP2ADUZPSPJANCNFSM5NR77KWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Ross Scroggs @.***

jay-eleven commented 2 years ago

Hi Ross!

Yes, counting drive files from the Vault console, does work:

image

I don't think gam is the culprit here, the API requests look good to me.

I'll open a ticket in Google's issue tracker.

Thanks Ross!!

jay-eleven commented 2 years ago

For completeness, issue created: https://issuetracker.google.com/issues/217910338

taers232c commented 2 years ago

See: https://developers.google.com/vault/guides/count

@.***

On Feb 4, 2022, at 10:11 AM, Jay @.***> wrote:

For completeness, issue created: https://issuetracker.google.com/issues/217910338 https://issuetracker.google.com/issues/217910338 — Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/238#issuecomment-1030230737, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL77CBDRBSJB3FKJKYTUZQJEBANCNFSM5NR77KWA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.

jay-eleven commented 2 years ago

Yes, the Vault API guide mentions only MAIL and GROUPS corpus are available for counting. It's the reference documentation that's a bit misleading.

Ah! You beat me to the punch updating gam command line options to mention only mail and groups is available. Good job!

jay-eleven commented 2 years ago

Google confirmed this is the intended behaviour. Only mail and groups are suggested.

taers232c commented 2 years ago

I think that the idea is to get a count of the number of addresses users/groups affected by the hold, not the number of objects help.

Ross

@.***

On Feb 11, 2022, at 4:21 PM, Jay @.***> wrote:

Google confirmed this is the intended behaviour. Only mail and groups are suggested.

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/238#issuecomment-1036833504, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL3A3EUZIKRH66E2QDTU2WR2NANCNFSM5NR77KWA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.