Lists the replies for a particular comment on a file. The file is specified by file ID. This example lists replies for comment (id="AAAABg7tSGw") on the file having id = "0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw".
LOCAL loRest
LOCAL lnSuccess
LOCAL loOauth2
LOCAL loSbJson
LOCAL loJson
LOCAL i
LOCAL lnCount_i
LOCAL lcKind
LOCAL lcId
LOCAL lcCreatedTime
LOCAL lcModifiedTime
LOCAL lcAuthorKind
LOCAL lcAuthorDisplayName
LOCAL lcAuthorPhotoLink
LOCAL lnAuthorMe
LOCAL lcHtmlContent
LOCAL lcContent
LOCAL lnDeleted
LOCAL lcAction
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
loRest.AddQueryParam("fields","replies")
loSbJson = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/drive/v3/files/0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw/comments/AAAABg7tSGw/replies",loSbJson)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
CANCEL
ENDIF
IF (loRest.ResponseStatusCode <> 200) THEN
? "Received error response code: " + STR(loRest.ResponseStatusCode)
? "Response body:"
? loSbJson.GetAsString()
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
CANCEL
ENDIF
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.LoadSb(loSbJson)
* The following code parses the JSON response.
* A sample JSON response is shown below the sample code.
i = 0
lnCount_i = loJson.SizeOfArray("replies")
DO WHILE i < lnCount_i
loJson.I = i
lcKind = loJson.StringOf("replies[i].kind")
lcId = loJson.StringOf("replies[i].id")
lcCreatedTime = loJson.StringOf("replies[i].createdTime")
lcModifiedTime = loJson.StringOf("replies[i].modifiedTime")
lcAuthorKind = loJson.StringOf("replies[i].author.kind")
lcAuthorDisplayName = loJson.StringOf("replies[i].author.displayName")
lcAuthorPhotoLink = loJson.StringOf("replies[i].author.photoLink")
lnAuthorMe = loJson.BoolOf("replies[i].author.me")
lcHtmlContent = loJson.StringOf("replies[i].htmlContent")
lcContent = loJson.StringOf("replies[i].content")
lnDeleted = loJson.BoolOf("replies[i].deleted")
lcAction = loJson.StringOf("replies[i].action")
i = i + 1
ENDDO
? "Example Completed."
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
RELEASE loJson
{
"replies": [
{
"kind": "drive#reply",
"id": "AAAABg76H9g",
"createdTime": "2017-11-13T18:24:12.782Z",
"modifiedTime": "2017-11-13T18:24:12.782Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the first reply to a comment.",
"content": "This is the first reply to a comment.",
"deleted": false,
"action": "reopen"
},
{
"kind": "drive#reply",
"id": "AAAABg76H9k",
"createdTime": "2017-11-13T18:24:45.085Z",
"modifiedTime": "2017-11-13T18:24:45.085Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the second reply to a comment.",
"content": "This is the second reply to a comment.",
"deleted": false,
"action": "resolve"
},
{
"kind": "drive#reply",
"id": "AAAABg76H9o",
"createdTime": "2017-11-13T18:25:11.828Z",
"modifiedTime": "2017-11-13T18:25:11.828Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the third reply to a comment.",
"content": "This is the third reply to a comment.",
"deleted": false,
"action": "resolve"
}
]
}