Python Fatturazione Elettronica Aruba IT: Get by Filename (Sent)

Back to Index

Questo metodo restituisce il dettaglio completo dello stato di una fattura elettronica.

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

CURL Command

curl -X GET  https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m \
-H 'Accept: application/json' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE='

Python Example

import sys
import chilkat

rest = chilkat.CkRest()

#  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m
bTls = True
port = 443
bAutoReconnect = True
success = rest.Connect("demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect)
if (success != True):
    print("ConnectFailReason: " + str(rest.get_ConnectFailReason()))
    print(rest.lastErrorText())
    sys.exit()

rest.AddHeader("Authorization","Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=")
rest.AddHeader("Accept","application/json")

sbResponseBody = chilkat.CkStringBuilder()
success = rest.FullRequestNoBodySb("GET","/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m",sbResponseBody)
if (success != True):
    print(rest.lastErrorText())
    sys.exit()

respStatusCode = rest.get_ResponseStatusCode()
if (respStatusCode >= 400):
    print("Response Status Code = " + str(respStatusCode))
    print("Response Header:")
    print(rest.responseHeader())
    print("Response Body:")
    print(sbResponseBody.getAsString())
    sys.exit()

jsonResponse = chilkat.CkJsonObject()
jsonResponse.LoadSb(sbResponseBody)

#  See the Online Tool for Generating JSON Parse Code

id = jsonResponse.stringOf("id")
senderDescription = jsonResponse.stringOf("sender.description")
senderCountryCode = jsonResponse.stringOf("sender.countryCode")
senderVatCode = jsonResponse.stringOf("sender.vatCode")
senderFiscalCode = jsonResponse.stringOf("sender.fiscalCode")
receiverDescription = jsonResponse.stringOf("receiver.description")
receiverCountryCode = jsonResponse.stringOf("receiver.countryCode")
receiverVatCode = jsonResponse.stringOf("receiver.vatCode")
receiverFiscalCode = jsonResponse.stringOf("receiver.fiscalCode")
invoiceType = jsonResponse.stringOf("invoiceType")
docType = jsonResponse.stringOf("docType")
file = jsonResponse.stringOf("file")
filename = jsonResponse.stringOf("filename")
username = jsonResponse.stringOf("username")
lastUpdate = jsonResponse.stringOf("lastUpdate")
idSdi = jsonResponse.stringOf("idSdi")
i = 0
count_i = jsonResponse.SizeOfArray("invoices")
while i < count_i :
    jsonResponse.put_I(i)
    invoiceDate = jsonResponse.stringOf("invoices[i].invoiceDate")
    number = jsonResponse.stringOf("invoices[i].number")
    status = jsonResponse.stringOf("invoices[i].status")
    i = i + 1

Sample JSON Response Body

{
  "id": "1",
  "sender": {
    "description": "Aruba SPA",
    "countryCode": "ITA",
    "vatCode": "6372762541",
    "fiscalCode": "N5Hnt9vvMZ"
  },
  "receiver": {
    "description": "Rossi SRL",
    "countryCode": "ITA",
    "vatCode": "8767263441",
    "fiscalCode": "LVZTeOJ8BN"
  },
  "invoiceType": "FPA12",
  "docType": "in",
  "file": "ZEdWemRBPT0=",
  "filename": "IT07026037883_jtlkl.xml.p7m",
  "invoices": [
    {
      "invoiceDate": "2019-01-21T17:36:21.179+01:00",
      "number": "1",
      "status": "Inviata"
    },
    {
      "invoiceDate": "2019-01-21T17:36:21.179+01:00",
      "number": "2",
      "status": "Consegnata"
    }
  ],
  "username": "Utente",
  "lastUpdate": "2019-01-21T17:36:21.179+01:00",
  "idSdi": null
}