I am trying to write a program that transfers users drive and docs files from one user to another. It looks like I can do it using this documentation Documentation.
I created the data transfer object, which looks like this:
datatransfer = {
'kind': 'admin#datatransfer#DataTransfer',
'oldOwnerUserId': 'somenumberhere',
'newOwnderUserId': 'adifferentnumberhere',
'applicationDataTransfers':[
{
'applicationId': '55656082996', #the app id for drive and docs
'applicationTransferParams': [
{
'key': 'PRIVACY_LEVEL',
'value': [
{
'PRIVATE',
'SHARED'
}
]
}
]
}
]
}
I have some code here for handling Oauth and then I bind the service with:
service = build('admin', 'datatransfer_v1', credentials=creds)
Then I attempt to call insert() with
results = service.transfers().insert(body=datatransfer).execute()
and I get back an error saying that it 'missing required field: resource'.
I tried nesting all of this inside a field called resource and I get the same message. I tried passing in JUST a json structure that looked like this {'resource': 'test'} and I get the same message. So I tried using the "Try this method" live tool on the documentation website, If I pass in no arguments at all, or just pass in the old and new user, I get the same message 'missing required nested field: resource'. If I put in 'id':'55656082996' with ANY other arguments it just says error code 500 backend error. I tried manually adding a field named "resource" to the live tool and it says 'property 'resource' does not exist in object specification"