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

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
ETrade
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
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 <CkRest.h>
#include <CkStringBuilder.h>
#include <CkJsonObject.h>

void ChilkatSample(void)
    {
    CkRest rest;
    bool success;

    success = rest.Connect("your.site.domain",443,true,true);
    if (success != true) {
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

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

    CkStringBuilder sbReq;

    CkStringBuilder sbJson;
    success = rest.FullRequestSb("POST","/rest/v10/oauth2/logout",sbReq,sbJson);
    if (success != true) {
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

    if (rest.get_ResponseStatusCode() != 200) {
        std::cout << "Received error response code: " << rest.get_ResponseStatusCode() << "\r\n";
        std::cout << "Response body:" << "\r\n";
        std::cout << sbJson.getAsString() << "\r\n";
        return;
    }

    CkJsonObject json;
    json.LoadSb(sbJson);

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

    success = json.BoolOf("success");

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

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

    std::cout << "Example Completed." << "\r\n";
    }

 

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