(Tcl) WhatsApp - Logout
Demonstrates the /v1/users/logout endpoint to logout of the WhatsApp Business API Client. Logging out revokes the authentication token. For more information, see https://developers.facebook.com/docs/whatsapp/api/users/logout
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Implements the following CURL command:
# curl -X POST https://your-webapp-hostname:your-webapp-port/v1/users/logout \
# -H "Authorization: Bearer your-auth-token"
# Adds the "Authorization: Bearer your-auth-token" header.
CkHttp_put_AuthToken $http "your-auth-token"
# resp is a CkHttpResponse
set resp [CkHttp_QuickRequest $http "POST" "https://your-webapp-hostname:your-webapp-port/v1/users/logout"]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
exit
}
puts "Response body:"
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttp $http
|