Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Visual FoxPro Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
ETrade
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Jira
Lightspeed
MYOB

Magento
MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PayPal
Peoplevox
Populi
QuickBooks
Rabobank
SMSAPI
SOAP finkok.com
Shippo
Shopify
SimpleTexting
Square
Stripe
SugarCRM
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
Xero
Yousign
_Miscellaneous_
eBay
effectconnect

 

 

 

(Visual FoxPro) Aruba Fatturazione Elettronica refresh

The 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.

For more information, see https://fatturazioneelettronica.aruba.it/apidoc/docs_EN.html#auth-refresh

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcAccess_token
LOCAL lcToken_type
LOCAL lnExpires_in
LOCAL lcRefresh_token
LOCAL lcUserName
LOCAL lcAs_client_id
LOCAL lcV_issued
LOCAL lcV_expires

* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loHttp = CreateObject('Chilkat_9_5_0.Http')

* 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

loReq = CreateObject('Chilkat_9_5_0.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/auth/signin"
loReq.ContentType = "application/x-www-form-urlencoded"
loReq.AddParam("grant_type","refresh_token")
loReq.AddParam("refresh_token","ee4aae0c9d754ad08a657510cae82efe")

loResp = loHttp.PostUrlEncoded("https://auth.fatturazioneelettronica.aruba.it/auth/signin",loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loReq
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

lcAccess_token = loJResp.StringOf("access_token")
lcToken_type = loJResp.StringOf("token_type")
lnExpires_in = loJResp.IntOf("expires_in")
lcRefresh_token = loJResp.StringOf("refresh_token")
lcUserName = loJResp.StringOf("userName")
lcAs_client_id = loJResp.StringOf("as:client_id")
lcV_issued = loJResp.StringOf('".issued"')
lcV_expires = loJResp.StringOf('".expires"')

RELEASE loHttp
RELEASE loReq
RELEASE loSbResponseBody
RELEASE loJResp


 

© 2000-2020 Chilkat Software, Inc. All Rights Reserved.