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

Unicode C Example

#include <C_CkRestW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>

void ChilkatSample(void)
    {
    HCkRestW rest;
    BOOL success;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    HCkStringBuilderW sbResponseBody;
    int respStatusCode;
    HCkJsonObjectW jsonResponse;
    BOOL last;
    int totalElements;
    int totalPages;
    int size;
    int number;
    BOOL first;
    int numberOfElements;
    int i;
    int count_i;
    const wchar_t *id;
    const wchar_t *senderDescription;
    const wchar_t *senderCountryCode;
    const wchar_t *senderVatCode;
    const wchar_t *senderFiscalCode;
    const wchar_t *receiverDescription;
    const wchar_t *receiverCountryCode;
    const wchar_t *receiverVatCode;
    const wchar_t *receiverFiscalCode;
    const wchar_t *invoiceType;
    const wchar_t *docType;
    const wchar_t *file;
    const wchar_t *filename;
    const wchar_t *username;
    const wchar_t *lastUpdate;
    const wchar_t *idSdi;
    int j;
    int count_j;
    const wchar_t *invoiceDate;
    const wchar_t *number_str;
    const wchar_t *status;

    rest = CkRestW_Create();

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Utente
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRestW_Connect(rest,L"demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect);
    if (success != TRUE) {
        wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        return;
    }

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

    sbResponseBody = CkStringBuilderW_Create();
    success = CkRestW_FullRequestNoBodySb(rest,L"GET",L"/services/invoice/in/findByUsername?username=Utente",sbResponseBody);
    if (success != TRUE) {
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        CkStringBuilderW_Dispose(sbResponseBody);
        return;
    }

    respStatusCode = CkRestW_getResponseStatusCode(rest);
    if (respStatusCode >= 400) {
        wprintf(L"Response Status Code = %d\n",respStatusCode);
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",CkRestW_responseHeader(rest));
        wprintf(L"Response Body:\n");
        wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));
        CkRestW_Dispose(rest);
        CkStringBuilderW_Dispose(sbResponseBody);
        return;
    }

    jsonResponse = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(jsonResponse,sbResponseBody);

    //  See the Online Tool for Generating JSON Parse Code

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

        i = i + 1;
    }



    CkRestW_Dispose(rest);
    CkStringBuilderW_Dispose(sbResponseBody);
    CkJsonObjectW_Dispose(jsonResponse);

    }

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
}