Patching Google Drive patch semantics - lmmx/devnotes GitHub Wiki

Google Drive's patch method doesn't work, and hasn't for over 3 years.

I'm not sure if this is why my attempts at changing the comments metadata with Drive.Comments.patch in Apps Script are failing - they seem to update (i.e. returning the modified resource) but then on a get request the resource is unchanged (a comment on a Google Docs file as specified by its commentId).

  • Must use X-HTTP-Method-Override: PATCH header.

Example given:

var url = 'https://www.googleapis.com/drive/v2/files/'
          + doc_id
          + '?setModifiedDate=true&updateViewedDate=true'
          + '&fields=imageMediaMetadata%2Fdate%2CmodifiedDate&key='
          + API_key

var options = {
    "method":                  "PUT",
    "oAuthServiceName":        "drive",
    "oAuthUseToken":           "always",
    "modifiedDate":            newModifiedDate,
    "imageMediaMetadata":      {"date": newDateTaken},
    "X-HTTP-Method-Override":  "PATCH"
              }

var Response = UrlFetchApp.fetch(url,options)  
var ResponseStr = Response.getContentText()

UrlFetchApp has been replaced by