Visual Basic 6.0 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" : ""
}'

Visual Basic 6.0 Example

Dim rest As New ChilkatRest
Dim success As Long

'  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect)
If (success <> 1) Then
    Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

'  See the Online Tool for Generating JSON Creation Code
Dim json As New ChilkatJsonObject
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 ChilkatStringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestSb("POST","/services/invoice/upload",sbRequestBody,sbResponseBody)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim respStatusCode As Long
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    Debug.Print "Response Status Code = " & respStatusCode
    Debug.Print "Response Header:"
    Debug.Print rest.ResponseHeader
    Debug.Print "Response Body:"
    Debug.Print sbResponseBody.GetAsString()
    Exit Sub
End If

Dim jsonResponse As New ChilkatJsonObject
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"
}