0

I uploaded several hundreds of old-ish (~2009-2010) videos (mpg, mts) to google photos, and to my dismay the EXIF metadata is either absent or not recognized, so they all get the date stamp set to when they were uploaded.

I figured I could use the Google Drive API to change the modifiedTime attribute since photos are accessible through there.

However, it seems the API does only provide read-only access to the photos spaces according to the scope, so I get a permission problem.

file_metadata = {
    'modifiedTime': some_custom_date#datetime.utcnow().isoformat() + 'Z'
}
file = DRIVE.files().update(fileId=file_id,
                                    body=file_metadata,
                                    fields='id, modifiedTime').execute()

Specifically, I get the error

HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/xxxxxxxxxxxxxxxxxxxxxx?fields=id%2C+modifiedTime&alt=json returned 

"The user has not granted the app yyyyyyyy write access to the file xxxxxxxxxxxxxxxxxxxxxx.">

So the question is if there is a way to modify files in the photos scope at all, through the Drive API? The error itself seems to suggest it is a permission that CAN be changed?

ako
  • 3,569
  • 4
  • 27
  • 38

1 Answers1

0

To alter the value of modifiedTime, you must be the owner of the file. Used the Try-it for this and it worked for me.

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56