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) Banco Inter Obtendo uma lista de boletosSee more Banco Inter ExamplesGet a list of tickets that match the search criteria. For more information, see https://developers.bancointer.com.br/reference/pesquisarboletos
load ./chilkat.dll # This example assumes the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set http [new_CkHttp] # Implements the following CURL command: # curl \ # -X GET \ # -H "Authorization: Bearer $TOKEN" \ # --cert <nome arquivo certificado>.crt \ # --key <nome arquivo chave privada>.key \ # --get \ # --data-urlencode "dataInicial=2022-04-01" \ # --data-urlencode "dataFinal=2022-04-03" \ # --data-urlencode "situacao=VENCIDO" \ # --data-urlencode "tipoOrdenacao=ASC" \ # --data-urlencode "itensPorPagina=10" \ # --data-urlencode "paginaAtual=2" \ # https://cdpj.partners.bancointer.com.br/cobranca/v2/boletos # Use the following online tool to generate HTTP code from a CURL command # Convert a cURL Command to HTTP Source Code set cert [new_CkCert] set success [CkCert_LoadFromFile $cert "<nome arquivo certificado>.crt"] if {$success == 0} then { puts [CkCert_lastErrorText $cert] delete_CkHttp $http delete_CkCert $cert exit } set bdPrivKey [new_CkBinData] set success [CkBinData_LoadFile $bdPrivKey "<nome arquivo chave privada>.key"] if {$success == 0} then { puts "Failed to load key" delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey exit } # Note: If your private key file requires a password, then set it here. # Otherwise pass the empty string. set privKeyPassword "" set privKey [new_CkPrivateKey] set success [CkPrivateKey_LoadAnyFormat $privKey $bdPrivKey $privKeyPassword] if {$success == 0} then { puts [CkPrivateKey_lastErrorText $privKey] delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey delete_CkPrivateKey $privKey exit } set success [CkCert_SetPrivateKey $cert $privKey] if {$success == 0} then { puts [CkCert_lastErrorText $cert] delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey delete_CkPrivateKey $privKey exit } CkHttp_SetSslClientCert $http $cert set queryParams [new_CkJsonObject] CkJsonObject_UpdateString $queryParams "dataInicial" "2022-04-01" CkJsonObject_UpdateString $queryParams "dataFinal" "2022-04-03" CkJsonObject_UpdateString $queryParams "situacao" "VENCIDO" CkJsonObject_UpdateString $queryParams "tipoOrdenacao" "ASC" CkJsonObject_UpdateInt $queryParams "itensPorPagina" 10 CkJsonObject_UpdateInt $queryParams "paginaAtual" 2 # Adds the "Authorization: Bearer $TOKEN" header. CkHttp_put_AuthToken $http "$TOKEN" # resp is a CkHttpResponse set resp [CkHttp_QuickRequestParams $http "GET" "https://cdpj.partners.bancointer.com.br/cobranca/v2/boletos" $queryParams] if {[CkHttp_get_LastMethodSuccess $http] == 0} then { puts [CkHttp_lastErrorText $http] delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey delete_CkPrivateKey $privKey delete_CkJsonObject $queryParams exit } set sbResponseBody [new_CkStringBuilder] CkHttpResponse_GetBodySb $resp $sbResponseBody set jResp [new_CkJsonObject] CkJsonObject_LoadSb $jResp $sbResponseBody CkJsonObject_put_EmitCompact $jResp 0 puts "Response Body:" puts [CkJsonObject_emit $jResp] set respStatusCode [CkHttpResponse_get_StatusCode $resp] puts "Response Status Code = $respStatusCode" if {$respStatusCode >= 400} then { puts "Response Header:" puts [CkHttpResponse_header $resp] puts "Failed." delete_CkHttpResponse $resp delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey delete_CkPrivateKey $privKey delete_CkJsonObject $queryParams delete_CkStringBuilder $sbResponseBody delete_CkJsonObject $jResp exit } delete_CkHttpResponse $resp # Sample JSON response: # (Sample code for parsing the JSON response is shown below) # { # "totalPages": 1, # "totalElements": 58, # "last": true, # "first": true, # "size": 100, # "numberOfElements": 58, # "content": [ # { # "nomeBeneficiario": "nome do beneficiario 1", # "cnpjCpfBeneficiario": "CNPJ/CPF beneficiario 1" # }, # { # "nomeBeneficiario": "nome do beneficiario 2", # "cnpjCpfBeneficiario": "CNPJ/CPF beneficiario 2" # }, # { # "nomeBeneficiario": "nome do beneficiario N", # "cnpjCpfBeneficiario": "CNPJ/CPF beneficiario N" # } # ] # } # Sample code for parsing the JSON response... # Use the following online tool to generate parsing code from sample JSON: # Generate Parsing Code from JSON set totalPages [CkJsonObject_IntOf $jResp "totalPages"] set totalElements [CkJsonObject_IntOf $jResp "totalElements"] set last [CkJsonObject_BoolOf $jResp "last"] set first [CkJsonObject_BoolOf $jResp "first"] set size [CkJsonObject_IntOf $jResp "size"] set numberOfElements [CkJsonObject_IntOf $jResp "numberOfElements"] set i 0 set count_i [CkJsonObject_SizeOfArray $jResp "content"] while {$i < $count_i} { CkJsonObject_put_I $jResp $i set nomeBeneficiario [CkJsonObject_stringOf $jResp "content[i].nomeBeneficiario"] set cnpjCpfBeneficiario [CkJsonObject_stringOf $jResp "content[i].cnpjCpfBeneficiario"] set i [expr $i + 1] } delete_CkHttp $http delete_CkCert $cert delete_CkBinData $bdPrivKey delete_CkPrivateKey $privKey delete_CkJsonObject $queryParams delete_CkStringBuilder $sbResponseBody delete_CkJsonObject $jResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.