Xojo Plugin Fatturazione Elettronica Aruba IT: Upload Invoice

Back to Index

Questo metodo deve essere utilizzato dall’OE per effettuare l’invio di una fattura già nel formato XML secondo norme AGID, ma non ancora firmata digitalmente.

Documentation: https://fatturazioneelettronica.aruba.it/apidoc/docs.html#_upload_invoice

CURL Command

curl -X POST  https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=' \
-d '{
  "dataFile" : "dGVzdA==",
  "credential" : "",
  "domain" : ""
}'

Xojo Plugin Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

//  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload
Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect)
If (success <> True) Then
    System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
    System.DebugLog(rest.LastErrorText)
    Return
End If

//  See the Online Tool for Generating JSON Creation Code
Dim json As New Chilkat.JsonObject
success = json.UpdateString("dataFile","dGVzdA==")
success = json.UpdateString("credential","")
success = json.UpdateString("domain","")

success = rest.AddHeader("Content-Type","application/json;charset=UTF-8")
success = rest.AddHeader("Authorization","Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=")
success = rest.AddHeader("Accept","application/json")

Dim sbRequestBody As New Chilkat.StringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST","/services/invoice/upload",sbRequestBody,sbResponseBody)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    System.DebugLog("Response Status Code = " + Str(respStatusCode))
    System.DebugLog("Response Header:")
    System.DebugLog(rest.ResponseHeader)
    System.DebugLog("Response Body:")
    System.DebugLog(sbResponseBody.GetAsString())
    Return
End If

Dim jsonResponse As New Chilkat.JsonObject
success = jsonResponse.LoadSb(sbResponseBody)

//  See the Online Tool for Generating JSON Parse Code
Dim errorCode As String
Dim errorDescription As String
Dim uploadFileName As String

errorCode = jsonResponse.StringOf("errorCode")
errorDescription = jsonResponse.StringOf("errorDescription")
uploadFileName = jsonResponse.StringOf("uploadFileName")

Sample JSON Response Body

{
  "errorCode": "",
  "errorDescription": "",
  "uploadFileName": "IT01787589930_bkemy.xml.p7m"
}