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 <C_CkRest.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

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

    rest = CkRest_Create();

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Utente
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRest_Connect(rest,"demows.fatturazioneelettronica.aruba.it",port,bTls,bAutoReconnect);
    if (success != TRUE) {
        printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        return;
    }

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

    sbResponseBody = CkStringBuilder_Create();
    success = CkRest_FullRequestNoBodySb(rest,"GET","/services/invoice/in/findByUsername?username=Utente",sbResponseBody);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    respStatusCode = CkRest_getResponseStatusCode(rest);
    if (respStatusCode >= 400) {
        printf("Response Status Code = %d\n",respStatusCode);
        printf("Response Header:\n");
        printf("%s\n",CkRest_responseHeader(rest));
        printf("Response Body:\n");
        printf("%s\n",CkStringBuilder_getAsString(sbResponseBody));
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    jsonResponse = CkJsonObject_Create();
    CkJsonObject_LoadSb(jsonResponse,sbResponseBody);

    //  See the Online Tool for Generating JSON Parse Code

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

        i = i + 1;
    }



    CkRest_Dispose(rest);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_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
}