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

Perl Example

use chilkat();

$rest = chilkat::CkRest->new();

#  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect("demows.fatturazioneelettronica.aruba.it",$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print "ConnectFailReason: " . $rest->get_ConnectFailReason() . "\r\n";
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$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 != 1) {
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$respStatusCode = $rest->get_ResponseStatusCode();
if ($respStatusCode >= 400) {
    print "Response Status Code = " . $respStatusCode . "\r\n";
    print "Response Header:" . "\r\n";
    print $rest->responseHeader() . "\r\n";
    print "Response Body:" . "\r\n";
    print $sbResponseBody->getAsString() . "\r\n";
    exit;
}

$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;
}

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
}