Visual FoxPro
Visual FoxPro
SugarCRM Logout
See more SugarCRM Examples
Demonstrates how to logout of a session.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loRest
LOCAL loSbReq
LOCAL loSbJson
LOCAL loJson
lnSuccess = 0
loRest = CreateObject('Chilkat.Rest')
lnSuccess = loRest.Connect("your.site.domain",443,1,1)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
loRest.AddHeader("Cache-Control","no-cache")
loRest.AddHeader("OAuth-Token","<access_token>")
loSbReq = CreateObject('Chilkat.StringBuilder')
loSbJson = CreateObject('Chilkat.StringBuilder')
lnSuccess = loRest.FullRequestSb("POST","/rest/v10/oauth2/logout",loSbReq,loSbJson)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loSbReq
RELEASE loSbJson
CANCEL
ENDIF
IF (loRest.ResponseStatusCode <> 200) THEN
? "Received error response code: " + STR(loRest.ResponseStatusCode)
? "Response body:"
? loSbJson.GetAsString()
RELEASE loRest
RELEASE loSbReq
RELEASE loSbJson
CANCEL
ENDIF
loJson = CreateObject('Chilkat.JsonObject')
loJson.LoadSb(loSbJson)
* The following code parses the JSON response.
* A sample JSON response is shown below the sample code.
lnSuccess = loJson.BoolOf("success")
* A sample JSON response body that is parsed by the above code:
* {
* "success": true
* }
? "Example Completed."
RELEASE loRest
RELEASE loSbReq
RELEASE loSbJson
RELEASE loJson