Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) qa.factura1.com.co Obtain Auth TokenDemonstrates how to send a JSON POST to get an authenticataion token for qa.factura1.com.co
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Variant vJson Handle hoJson Boolean iSuccess Variant vResp Handle hoResp Handle hoJsonResp String sTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Build the following JSON // { // "password": "MY_PASSWORD", // "username": "MY_USERNAME" // } Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Set ComEmitCompact Of hoJson To False Get ComUpdateString Of hoJson "password" "MY_PASSWORD" To iSuccess Get ComUpdateString Of hoJson "username" "MY_USERNAME" To iSuccess Get pvComObject of hoJson to vJson Get ComPostJson3 Of hoHttp "https://qa.factura1.com.co/v2/auth" "application/json" vJson To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResp If (Not(IsComObjectCreated(hoJsonResp))) Begin Send CreateComObject of hoJsonResp End Set ComEmitCompact Of hoJsonResp To False Get ComBodyStr Of hoResp To sTemp1 Get ComLoad Of hoJsonResp sTemp1 To iSuccess Send Destroy of hoResp Get ComEmit Of hoJsonResp To sTemp1 Showln sTemp1 Get ComStringOf Of hoJsonResp "token" To sTemp1 Showln "Access token: " sTemp1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.