Unicode C++ 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='

Unicode C++ Example

#include <CkRestW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>

void ChilkatSample(void)
    {
    CkRestW rest;
    bool success;

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect(L"demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect);
    if (success != true) {
        wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

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

    CkStringBuilderW sbResponseBody;
    success = rest.FullRequestNoBodySb(L"GET",L"/services/invoice/out/getByFilename?filename=IT07026037883_jtlkl.xml.p7m",sbResponseBody);
    if (success != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    int respStatusCode = rest.get_ResponseStatusCode();
    if (respStatusCode >= 400) {
        wprintf(L"Response Status Code = %d\n",respStatusCode);
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",rest.responseHeader());
        wprintf(L"Response Body:\n");
        wprintf(L"%s\n",sbResponseBody.getAsString());
        return;
    }

    CkJsonObjectW jsonResponse;
    jsonResponse.LoadSb(sbResponseBody);

    //  See the Online Tool for Generating JSON Parse Code
    const wchar_t *id = 0;
    const wchar_t *senderDescription = 0;
    const wchar_t *senderCountryCode = 0;
    const wchar_t *senderVatCode = 0;
    const wchar_t *senderFiscalCode = 0;
    const wchar_t *receiverDescription = 0;
    const wchar_t *receiverCountryCode = 0;
    const wchar_t *receiverVatCode = 0;
    const wchar_t *receiverFiscalCode = 0;
    const wchar_t *invoiceType = 0;
    const wchar_t *docType = 0;
    const wchar_t *file = 0;
    const wchar_t *filename = 0;
    const wchar_t *username = 0;
    const wchar_t *lastUpdate = 0;
    const wchar_t *idSdi = 0;
    int i;
    int count_i;
    const wchar_t *invoiceDate = 0;
    const wchar_t *number = 0;
    const wchar_t *status = 0;

    id = jsonResponse.stringOf(L"id");
    senderDescription = jsonResponse.stringOf(L"sender.description");
    senderCountryCode = jsonResponse.stringOf(L"sender.countryCode");
    senderVatCode = jsonResponse.stringOf(L"sender.vatCode");
    senderFiscalCode = jsonResponse.stringOf(L"sender.fiscalCode");
    receiverDescription = jsonResponse.stringOf(L"receiver.description");
    receiverCountryCode = jsonResponse.stringOf(L"receiver.countryCode");
    receiverVatCode = jsonResponse.stringOf(L"receiver.vatCode");
    receiverFiscalCode = jsonResponse.stringOf(L"receiver.fiscalCode");
    invoiceType = jsonResponse.stringOf(L"invoiceType");
    docType = jsonResponse.stringOf(L"docType");
    file = jsonResponse.stringOf(L"file");
    filename = jsonResponse.stringOf(L"filename");
    username = jsonResponse.stringOf(L"username");
    lastUpdate = jsonResponse.stringOf(L"lastUpdate");
    idSdi = jsonResponse.stringOf(L"idSdi");
    i = 0;
    count_i = jsonResponse.SizeOfArray(L"invoices");
    while (i < count_i) {
        jsonResponse.put_I(i);
        invoiceDate = jsonResponse.stringOf(L"invoices[i].invoiceDate");
        number = jsonResponse.stringOf(L"invoices[i].number");
        status = jsonResponse.stringOf(L"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
}