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
(Tcl) qa.factura1.com.co Obtain Auth TokenDemonstrates how to send a JSON POST to get an authenticataion token for qa.factura1.com.co
load ./chilkat.dll # This example requires the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set http [new_CkHttp] # Build the following JSON # { # "password": "MY_PASSWORD", # "username": "MY_USERNAME" # } set json [new_CkJsonObject] CkJsonObject_put_EmitCompact $json 0 CkJsonObject_UpdateString $json "password" "MY_PASSWORD" CkJsonObject_UpdateString $json "username" "MY_USERNAME" # resp is a CkHttpResponse set resp [CkHttp_PostJson3 $http "https://qa.factura1.com.co/v2/auth" "application/json" $json] if {[CkHttp_get_LastMethodSuccess $http] == 0} then { puts [CkHttp_lastErrorText $http] delete_CkHttp $http delete_CkJsonObject $json exit } set jsonResp [new_CkJsonObject] CkJsonObject_put_EmitCompact $jsonResp 0 CkJsonObject_Load $jsonResp [CkHttpResponse_bodyStr $resp] delete_CkHttpResponse $resp puts [CkJsonObject_emit $jsonResp] puts "Access token: [CkJsonObject_stringOf $jsonResp token]" delete_CkHttp $http delete_CkJsonObject $json delete_CkJsonObject $jsonResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.