Updates a Team Drive's metadata. This example sends a PATCH request to rename the team drive having id = 0ANGJSBRcgM0nUk9PVA.
Dim rest As New ChilkatRest
Dim success As Long
' Provide a previously obtained OAuth2 access token.
Dim oauth2 As New ChilkatOAuth2
oauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
success = rest.SetAuthOAuth2(oauth2)
success = rest.Connect("www.googleapis.com",443,1,1)
If (success <> 1) Then
Debug.Print rest.LastErrorText
Exit Sub
End If
' The following code creates the JSON request body.
' The JSON created by this code is shown below.
Dim jsonReq As New ChilkatJsonObject
success = jsonReq.UpdateString("name","Project Terra Firma")
Dim sbReq As New ChilkatStringBuilder
success = jsonReq.EmitSb(sbReq)
success = rest.AddHeader("Content-Type","application/json")
Dim sbJson As New ChilkatStringBuilder
success = rest.FullRequestSb("PATCH","/drive/v3/teamdrives/0ANGJSBRcgM0nUk9PVA",sbReq,sbJson)
If (success <> 1) Then
Debug.Print rest.LastErrorText
Exit Sub
End If
If (rest.ResponseStatusCode <> 200) Then
Debug.Print "Received error response code: " & rest.ResponseStatusCode
Debug.Print "Response body:"
Debug.Print sbJson.GetAsString()
Exit Sub
End If
Dim json As New ChilkatJsonObject
success = json.LoadSb(sbJson)
' The following code parses the JSON response.
' A sample JSON response is shown below the sample code.
Dim kind As String
Dim id As String
Dim name As String
kind = json.StringOf("kind")
id = json.StringOf("id")
name = json.StringOf("name")
Debug.Print "Example Completed."
{
"name": "Project Terra Firma"
}
{
"kind": "drive#teamDrive",
"id": "0ANGJSBRcgM0nUk9PVA",
"name": "Project Terra Firma"
}