Sample code for 30+ languages & platforms
Visual Basic 6.0

SugarCRM Logout

See more SugarCRM Examples

Demonstrates how to logout of a session.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim rest As New ChilkatRest

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.

success = json.BoolOf("success")

' A sample JSON response body that is parsed by the above code:

' {
'   "success": true
' }

Debug.Print "Example Completed."