Visual FoxPro Google Drive: Delete a Reply from a Comment

Back to Index

Deletes a reply from a comment. This example deletes reply (id="AAAABg76H9o") from a comment (id="AAAABg7tSGw") on the file (id= "0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw")

Documentation: https://developers.google.com/drive/v3/reference/replies/delete


LOCAL loRest
LOCAL lnSuccess
LOCAL loOauth2
LOCAL loSbResponse

loRest = CreateObject('Chilkat_9_5_0.Rest')

*   Provide a previously obtained OAuth2 access token.
loOauth2 = CreateObject('Chilkat_9_5_0.OAuth2')
loOauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
loRest.SetAuthOAuth2(loOauth2)

lnSuccess = loRest.Connect("www.googleapis.com",443,1,1)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    CANCEL
ENDIF

loSbResponse = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("DELETE","/drive/v3/files/0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw/comments/AAAABg7tSGw/replies/AAAABg76H9o",loSbResponse)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbResponse
    CANCEL
ENDIF

IF (loRest.ResponseStatusCode <> 204) THEN
    ? "Received error response code: " + STR(loRest.ResponseStatusCode)
    ? "Response body:"
    ? loSbResponse.GetAsString()
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbResponse
    CANCEL
ENDIF

? "Example Completed."

RELEASE loRest
RELEASE loOauth2
RELEASE loSbResponse