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

Back to Index

Ricerca una lista di fatture. Ritorna le fatture senza il contenuto in base64 (lazy loading)

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

CURL Command

curl -X GET  https://demows.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Utente \
-H 'Accept: application/json' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE='

C++ Example

#include <CkRest.h>
#include <CkStringBuilder.h>
#include <CkJsonObject.h>

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

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Utente
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect("demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect);
    if (success != true) {
        std::cout << "ConnectFailReason: " << rest.get_ConnectFailReason() << "\r\n";
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

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

    CkStringBuilder sbResponseBody;
    success = rest.FullRequestNoBodySb("GET","/services/invoice/in/findByUsername?username=Utente",sbResponseBody);
    if (success != true) {
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

    int respStatusCode = rest.get_ResponseStatusCode();
    if (respStatusCode >= 400) {
        std::cout << "Response Status Code = " << respStatusCode << "\r\n";
        std::cout << "Response Header:" << "\r\n";
        std::cout << rest.responseHeader() << "\r\n";
        std::cout << "Response Body:" << "\r\n";
        std::cout << sbResponseBody.getAsString() << "\r\n";
        return;
    }

    CkJsonObject 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 char *id = 0;
    const char *senderDescription = 0;
    const char *senderCountryCode = 0;
    const char *senderVatCode = 0;
    const char *senderFiscalCode = 0;
    const char *receiverDescription = 0;
    const char *receiverCountryCode = 0;
    const char *receiverVatCode = 0;
    const char *receiverFiscalCode = 0;
    const char *invoiceType = 0;
    const char *docType = 0;
    const char *file = 0;
    const char *filename = 0;
    const char *username = 0;
    const char *lastUpdate = 0;
    const char *idSdi = 0;
    int j;
    int count_j;
    const char *invoiceDate = 0;
    const char *number_str = 0;
    const char *status = 0;

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

        i = i + 1;
    }
    }

Sample JSON Response Body

{
  "content": [
    {
      "id": "0",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037880_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.818+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.819+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "1",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037881_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "2",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037882_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "3",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037883_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "4",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037884_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "5",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037885_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "6",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037886_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.824+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.824+01:00",
      "idSdi": null
    },
    {
      "id": "7",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037887_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.825+01:00",
      "idSdi": null
    },
    {
      "id": "8",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037888_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.825+01:00",
      "idSdi": null
    },
    {
      "id": "9",
      "sender": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "22222222",
        "fiscalCode": "11111111111"
      },
      "receiver": {
        "description": "Aruba SPA",
        "countryCode": "IT",
        "vatCode": "4444444",
        "fiscalCode": "333333333"
      },
      "invoiceType": "FPA12",
      "docType": "in",
      "file": null,
      "filename": "IT07026037889_jtlkl.xml.p7m",
      "invoices": [
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "1",
          "status": "Inviata"
        },
        {
          "invoiceDate": "2019-01-21T17:36:10.825+01:00",
          "number": "2",
          "status": "Consegnata"
        }
      ],
      "username": "Utente",
      "lastUpdate": "2019-01-21T17:36:10.825+01:00",
      "idSdi": null
    }
  ],
  "last": true,
  "totalElements": 10,
  "totalPages": 1,
  "size": 10,
  "number": 0,
  "first": true,
  "numberOfElements": 10
}