Unicode C++ Fatturazione Elettronica Aruba IT: Find by Username (Sent)

Back to Index

Questo metodo restituisce l’elenco delle fatture elettroniche inviate dall’utente e prese in carico dal sistema. La lista di Fatture ritorna senza il contenuto in base64 (lazy loading)

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

CURL Command

curl -X GET  https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/findByUsername?username=Utente \
-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/findByUsername?username=Utente
    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/findByUsername?username=Utente",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
    bool last;
    int totalElements;
    int totalPages;
    int size;
    int number;
    bool first;
    int numberOfElements;
    int i;
    int count_i;
    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;
    int idSdi;
    int j;
    int count_j;
    const wchar_t *invoiceDate = 0;
    const wchar_t *number_str = 0;
    const wchar_t *status = 0;

    last = jsonResponse.BoolOf(L"last");
    totalElements = jsonResponse.IntOf(L"totalElements");
    totalPages = jsonResponse.IntOf(L"totalPages");
    size = jsonResponse.IntOf(L"size");
    number = jsonResponse.IntOf(L"number");
    first = jsonResponse.BoolOf(L"first");
    numberOfElements = jsonResponse.IntOf(L"numberOfElements");
    i = 0;
    count_i = jsonResponse.SizeOfArray(L"content");
    while (i < count_i) {
        jsonResponse.put_I(i);
        id = jsonResponse.stringOf(L"content[i].id");
        senderDescription = jsonResponse.stringOf(L"content[i].sender.description");
        senderCountryCode = jsonResponse.stringOf(L"content[i].sender.countryCode");
        senderVatCode = jsonResponse.stringOf(L"content[i].sender.vatCode");
        senderFiscalCode = jsonResponse.stringOf(L"content[i].sender.fiscalCode");
        receiverDescription = jsonResponse.stringOf(L"content[i].receiver.description");
        receiverCountryCode = jsonResponse.stringOf(L"content[i].receiver.countryCode");
        receiverVatCode = jsonResponse.stringOf(L"content[i].receiver.vatCode");
        receiverFiscalCode = jsonResponse.stringOf(L"content[i].receiver.fiscalCode");
        invoiceType = jsonResponse.stringOf(L"content[i].invoiceType");
        docType = jsonResponse.stringOf(L"content[i].docType");
        file = jsonResponse.stringOf(L"content[i].file");
        filename = jsonResponse.stringOf(L"content[i].filename");
        username = jsonResponse.stringOf(L"content[i].username");
        lastUpdate = jsonResponse.stringOf(L"content[i].lastUpdate");
        idSdi = jsonResponse.IntOf(L"content[i].idSdi");
        j = 0;
        count_j = jsonResponse.SizeOfArray(L"content[i].invoices");
        while (j < count_j) {
            jsonResponse.put_J(j);
            invoiceDate = jsonResponse.stringOf(L"content[i].invoices[j].invoiceDate");
            number_str = jsonResponse.stringOf(L"content[i].invoices[j].number");
            status = jsonResponse.stringOf(L"content[i].invoices[j].status");
            j = j + 1;
        }

        i = i + 1;
    }
    }

Sample JSON Response Body

{
  "content": [
    {
      "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": null,
      "filename": "IT07026037883_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:20.835+01:00",
          "number": "1",
          "status": "Inviata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:20.835+01:00",
      "idSdi": 7895
    },
    {
      "id": "2",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "fKo",
        "vatCode": "0845927294",
        "fiscalCode": "1dzZUPwfhO"
      },
      "receiver": {
        "description": "Rossi SRL",
        "countryCode": "WGf",
        "vatCode": "7188186772",
        "fiscalCode": "p46bxpoQgx"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT00499202641_kwefc.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:20.835+01:00",
          "number": "1",
          "status": "Inviata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:20.835+01:00",
      "idSdi": 7895
    },
    {
      "id": "3",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "56215678997",
        "fiscalCode": "94170917594"
      },
      "receiver": {
        "description": "Rossi SRL",
        "countryCode": "IT",
        "vatCode": "27446044667",
        "fiscalCode": "13591589640"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT01787589930_bkemy.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:20.835+01:00",
          "number": "1",
          "status": "Inviata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:20.835+01:00",
      "idSdi": 7895
    },
    {
      "id": "4",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "51878525587",
        "fiscalCode": "37556497667"
      },
      "receiver": {
        "description": "Rossi SRL",
        "countryCode": "IT",
        "vatCode": "95708696901",
        "fiscalCode": "69989572913"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT06620176401_pdrjw.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:20.835+01:00",
          "number": "1",
          "status": "Inviata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:20.835+01:00",
      "idSdi": 7895
    }
  ],
  "last": true,
  "totalElements": 4,
  "totalPages": 1,
  "size": 10,
  "number": 0,
  "first": true,
  "numberOfElements": 4
}