Ruby 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='

Ruby Example

require 'chilkat'

rest = Chilkat::CkRest.new()

#  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: " + rest.get_ConnectFailReason().to_s() + "\n";
    print rest.lastErrorText() + "\n";
    exit
end

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

sbResponseBody = Chilkat::CkStringBuilder.new()
success = rest.FullRequestNoBodySb("GET","/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m",sbResponseBody)
if (success != true)
    print rest.lastErrorText() + "\n";
    exit
end

respStatusCode = rest.get_ResponseStatusCode()
if (respStatusCode >= 400)
    print "Response Status Code = " + respStatusCode.to_s() + "\n";
    print "Response Header:" + "\n";
    print rest.responseHeader() + "\n";
    print "Response Body:" + "\n";
    print sbResponseBody.getAsString() + "\n";
    exit
end

jsonResponse = Chilkat::CkJsonObject.new()
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
end

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
}