B4X
B4X
MedTunnel: Logout
See more MedTunnel Examples
Close the session for the logged in User.Chilkat B4X Downloads
Dim success As Boolean = False
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As ChilkatHttp
http.Initialize("http")
' Implements the following CURL command:
' curl -X GET -k
' -H "Authorization:PutAuthorizationTokenHere"
' https://server.medtunnel.com/MedTunnelSvc/api/Authenticate/Logout
' Use the following online tool to generate HTTP code from a CURL command
' Convert a cURL Command to HTTP Source Code
http.SetRequestHeader("Authorization", "PutAuthorizationTokenHere")
Dim sbResponseBody As ChilkatStringBuilder
sbResponseBody.Initialize
success = http.QuickGetSb("https://server.medtunnel.com/MedTunnelSvc/api/Authenticate/Logout", sbResponseBody)
If success = False Then
Log(http.LastErrorText)
Return
End If
Dim jResp As ChilkatJsonObject
jResp.Initialize
jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False
Log("Response Body:")
Log(jResp.Emit)
Dim respStatusCode As Int = http.LastStatus
Log("Response Status Code = " & respStatusCode)
If respStatusCode >= 400 Then
Log("Response Header:")
Log(http.LastHeader)
Log("Failed.")
Return
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "ReturnCode": 1,
' "ReturnCodeText": "Success",
' "Data": "1"
' }
' Sample code for parsing the JSON response...
' Use the following online tool to generate parsing code from sample JSON:
' Generate Parsing Code from JSON
Dim ReturnCode As Int = jResp.IntOf("ReturnCode")
Dim ReturnCodeText As String = jResp.StringOf("ReturnCodeText")
Dim Data As String = jResp.StringOf("Data")