|  | 
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
| (Unicode C) SugarCRM LogoutDemonstrates how to logout of a session. 
 #include <C_CkRestW.h> #include <C_CkStringBuilderW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkRestW rest; BOOL success; HCkStringBuilderW sbReq; HCkStringBuilderW sbJson; HCkJsonObjectW json; BOOL success; rest = CkRestW_Create(); success = CkRestW_Connect(rest,L"your.site.domain",443,TRUE,TRUE); if (success != TRUE) { wprintf(L"%s\n",CkRestW_lastErrorText(rest)); CkRestW_Dispose(rest); return; } CkRestW_AddHeader(rest,L"Cache-Control",L"no-cache"); CkRestW_AddHeader(rest,L"OAuth-Token",L"<access_token>"); sbReq = CkStringBuilderW_Create(); sbJson = CkStringBuilderW_Create(); success = CkRestW_FullRequestSb(rest,L"POST",L"/rest/v10/oauth2/logout",sbReq,sbJson); if (success != TRUE) { wprintf(L"%s\n",CkRestW_lastErrorText(rest)); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbReq); CkStringBuilderW_Dispose(sbJson); return; } if (CkRestW_getResponseStatusCode(rest) != 200) { wprintf(L"Received error response code: %d\n",CkRestW_getResponseStatusCode(rest)); wprintf(L"Response body:\n"); wprintf(L"%s\n",CkStringBuilderW_getAsString(sbJson)); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbReq); CkStringBuilderW_Dispose(sbJson); return; } json = CkJsonObjectW_Create(); CkJsonObjectW_LoadSb(json,sbJson); // The following code parses the JSON response. // A sample JSON response is shown below the sample code. success = CkJsonObjectW_BoolOf(json,L"success"); // A sample JSON response body that is parsed by the above code: // { // "success": true // } wprintf(L"Example Completed.\n"); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbReq); CkStringBuilderW_Dispose(sbJson); CkJsonObjectW_Dispose(json); } | ||||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.