Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

C Web API Examples

Primary Categories

CardConnect
Facebook
GeoOp
Jira
Microsoft Calendar
PayPal
Peoplevox

QuickBooks
Shopify
Stripe
SugarCRM
Twitter
VoiceBase
Walmart
Xero
eBay
effectconnect

 

 

 

(C) SugarCRM Logout

Demonstrates how to logout of a session.

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkRest rest;
    BOOL success;
    HCkStringBuilder sbReq;
    HCkStringBuilder sbJson;
    HCkJsonObject json;
    BOOL success;

    rest = CkRest_Create();

    success = CkRest_Connect(rest,"your.site.domain",443,TRUE,TRUE);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

    CkRest_AddHeader(rest,"Cache-Control","no-cache");
    CkRest_AddHeader(rest,"OAuth-Token","<access_token>");

    sbReq = CkStringBuilder_Create();

    sbJson = CkStringBuilder_Create();
    success = CkRest_FullRequestSb(rest,"POST","/rest/v10/oauth2/logout",sbReq,sbJson);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbReq);
        CkStringBuilder_Dispose(sbJson);
        return;
    }

    if (CkRest_getResponseStatusCode(rest) != 200) {
        printf("Received error response code: %d\n",CkRest_getResponseStatusCode(rest));
        printf("Response body:\n");
        printf("%s\n",CkStringBuilder_getAsString(sbJson));
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbReq);
        CkStringBuilder_Dispose(sbJson);
        return;
    }

    json = CkJsonObject_Create();
    CkJsonObject_LoadSb(json,sbJson);

    // The following code parses the JSON response.
    // A sample JSON response is shown below the sample code.

    success = CkJsonObject_BoolOf(json,"success");

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

    // {
    //   "success": true
    // }

    printf("Example Completed.\n");


    CkRest_Dispose(rest);
    CkStringBuilder_Dispose(sbReq);
    CkStringBuilder_Dispose(sbJson);
    CkJsonObject_Dispose(json);

    }

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.