![]() |
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
(DataFlex) Aruba Fatturazione Elettronica refreshThe token can be renewed by submitting a refresh request, which requires the following parameters in the format application/x-www-form-urlencoded with UTF-8 encoding. Refreshing the token, avoiding sending login details, offers more security and a more efficient process than requesting a new token via signin. Note: This example requires Chilkat v11.0.0 or greater. For more information, see https://fatturazioneelettronica.aruba.it/apidoc/docs_EN.html#auth-refresh
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoHttp Variant vReq Handle hoReq Variant vResp Handle hoResp Variant vSbResponseBody Handle hoSbResponseBody Handle hoJResp Integer iRespStatusCode String sAccess_token String sToken_type Integer iExpires_in String sRefresh_token String sUserName String sAs_client_id String sV_issued String sV_expires String sTemp1 Move False To iSuccess // This example assumes 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 // Implements the following CURL command: // curl -X POST https://auth.fatturazioneelettronica.aruba.it/auth/signin \ // -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \ // -d 'grant_type=refresh_token&refresh_token=ee4aae0c9d754ad08a657510cae82efe' // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code Get Create (RefClass(cComChilkatHttpRequest)) To hoReq If (Not(IsComObjectCreated(hoReq))) Begin Send CreateComObject of hoReq End Set ComHttpVerb Of hoReq To "POST" Set ComPath Of hoReq To "/auth/signin" Set ComContentType Of hoReq To "application/x-www-form-urlencoded" Send ComAddParam To hoReq "grant_type" "refresh_token" Send ComAddParam To hoReq "refresh_token" "ee4aae0c9d754ad08a657510cae82efe" Get Create (RefClass(cComChilkatHttpResponse)) To hoResp If (Not(IsComObjectCreated(hoResp))) Begin Send CreateComObject of hoResp End Get pvComObject of hoReq to vReq Get pvComObject of hoResp to vResp Get ComHttpReq Of hoHttp "https://auth.fatturazioneelettronica.aruba.it/auth/signin" vReq vResp To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody If (Not(IsComObjectCreated(hoSbResponseBody))) Begin Send CreateComObject of hoSbResponseBody End Get pvComObject of hoSbResponseBody to vSbResponseBody Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess Get Create (RefClass(cComChilkatJsonObject)) To hoJResp If (Not(IsComObjectCreated(hoJResp))) Begin Send CreateComObject of hoJResp End Get pvComObject of hoSbResponseBody to vSbResponseBody Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess Set ComEmitCompact Of hoJResp To False Showln "Response Body:" Get ComEmit Of hoJResp To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iRespStatusCode Showln "Response Status Code = " iRespStatusCode If (iRespStatusCode >= 400) Begin Showln "Response Header:" Get ComHeader Of hoResp To sTemp1 Showln sTemp1 Showln "Failed." Procedure_Return End // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "access_token": "29dba5b2e749e403", // "token_type": "bearer", // "expires_in": 1800, // "refresh_token": "5da9e6c31c8b9b24", // "userName": "Utente", // "as:client_id": "Auth", // ".issued": "Fri, 10 Jul 2020 07:20:00 GMT", // ".expires": "Fri, 10 Jul 2020 07:50:00 GMT" // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON Get ComStringOf Of hoJResp "access_token" To sAccess_token Get ComStringOf Of hoJResp "token_type" To sToken_type Get ComIntOf Of hoJResp "expires_in" To iExpires_in Get ComStringOf Of hoJResp "refresh_token" To sRefresh_token Get ComStringOf Of hoJResp "userName" To sUserName Get ComStringOf Of hoJResp "as:client_id" To sAs_client_id Get ComStringOf Of hoJResp '".issued"' To sV_issued Get ComStringOf Of hoJResp '".expires"' To sV_expires End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.