Deletes a particular comment on a file. The file is specified by file ID. This example deletes the comment (id="AAAABg7vWfw") from the file having id = "0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw".
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Variant vOauth2
Handle hoOauth2
Variant vSbResponse
Handle hoSbResponse
String sTemp1
Integer iTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// Provide a previously obtained OAuth2 access token.
Get Create (RefClass(cComChilkatOAuth2)) To hoOauth2
If (Not(IsComObjectCreated(hoOauth2))) Begin
Send CreateComObject of hoOauth2
End
Set ComAccessToken Of hoOauth2 To "OAUTH2_ACCESS_TOKEN"
Get pvComObject of hoOauth2 to vOauth2
Get ComSetAuthOAuth2 Of hoRest vOauth2 To iSuccess
Get ComConnect Of hoRest "www.googleapis.com" 443 True True To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponse
If (Not(IsComObjectCreated(hoSbResponse))) Begin
Send CreateComObject of hoSbResponse
End
Get pvComObject of hoSbResponse to vSbResponse
Get ComFullRequestNoBodySb Of hoRest "DELETE" "/drive/v3/files/0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw/comments/AAAABg7vWfw" vSbResponse To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComResponseStatusCode Of hoRest To iTemp1
If (iTemp1 <> 204) Begin
Get ComResponseStatusCode Of hoRest To iTemp1
Showln "Received error response code: " iTemp1
Showln "Response body:"
Get ComGetAsString Of hoSbResponse To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Example Completed."
End_Procedure