Sample code for 30+ languages & platforms
Visual FoxPro

WhatsApp - Logout

Demonstrates the /v1/users/logout endpoint to logout of the WhatsApp Business API Client. Logging out revokes the authentication token.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL loResp

lnSuccess = 0

*  This example assumes the Chilkat API to have been previously unlocked.
*  See Global Unlock Sample for sample code.

loHttp = CreateObject('Chilkat.Http')

*  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.
loHttp.AuthToken = "your-auth-token"

loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpNoBody("POST","https://your-webapp-hostname:your-webapp-port/v1/users/logout",loResp)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loResp
    CANCEL
ENDIF

? "Response body:"
? loResp.BodyStr

RELEASE loHttp
RELEASE loResp