(Visual Basic 6.0) SugarCRM Logout
Demonstrates how to logout of a session.
Dim rest As New ChilkatRest
Dim success As Long
success = rest.Connect("your.site.domain",443,1,1)
If (success <> 1) Then
Debug.Print rest.LastErrorText
Exit Sub
End If
success = rest.AddHeader("Cache-Control","no-cache")
success = rest.AddHeader("OAuth-Token","<access_token>")
Dim sbReq As New ChilkatStringBuilder
Dim sbJson As New ChilkatStringBuilder
success = rest.FullRequestSb("POST","/rest/v10/oauth2/logout",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 success As Long
success = json.BoolOf("success")
' A sample JSON response body that is parsed by the above code:
' {
' "success": true
' }
Debug.Print "Example Completed."
|