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

DataFlex Example

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoRest
    Boolean iSuccess
    Boolean iBTls
    Integer iPort
    Boolean iBAutoReconnect
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Integer iRespStatusCode
    Handle hoJsonResponse
    Boolean iLast
    Integer iTotalElements
    Integer iTotalPages
    Integer iSize
    Integer iNumber
    Boolean iFirst
    Integer iNumberOfElements
    Integer i
    Integer iCount_i
    String sId
    String sSenderDescription
    String sSenderCountryCode
    String sSenderVatCode
    String sSenderFiscalCode
    String sReceiverDescription
    String sReceiverCountryCode
    String sReceiverVatCode
    String sReceiverFiscalCode
    String sInvoiceType
    String sDocType
    String sFile
    String sFilename
    String sUsername
    String sLastUpdate
    String sIdSdi
    Integer j
    Integer iCount_j
    String sInvoiceDate
    String sNumber_str
    String sStatus
    String sTemp1
    Integer iTemp1

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Utente
    Move True To iBTls
    Move 443 To iPort
    Move True To iBAutoReconnect
    Get ComConnect Of hoRest "demows.fatturazioneelettronica.aruba.it" iPort iBTls iBAutoReconnect To iSuccess
    If (iSuccess <> True) Begin
        Get ComConnectFailReason Of hoRest To iTemp1
        Showln "ConnectFailReason: " iTemp1
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComAddHeader Of hoRest "Authorization" "Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" To iSuccess
    Get ComAddHeader Of hoRest "Accept" "application/json" To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComFullRequestNoBodySb Of hoRest "GET" "/services/invoice/in/findByUsername?username=Utente" vSbResponseBody To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComResponseStatusCode Of hoRest To iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Status Code = " iRespStatusCode
        Showln "Response Header:"
        Get ComResponseHeader Of hoRest To sTemp1
        Showln sTemp1
        Showln "Response Body:"
        Get ComGetAsString Of hoSbResponseBody To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
    If (Not(IsComObjectCreated(hoJsonResponse))) Begin
        Send CreateComObject of hoJsonResponse
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJsonResponse vSbResponseBody To iSuccess

    //  See the Online Tool for Generating JSON Parse Code

    Get ComBoolOf Of hoJsonResponse "last" To iLast
    Get ComIntOf Of hoJsonResponse "totalElements" To iTotalElements
    Get ComIntOf Of hoJsonResponse "totalPages" To iTotalPages
    Get ComIntOf Of hoJsonResponse "size" To iSize
    Get ComIntOf Of hoJsonResponse "number" To iNumber
    Get ComBoolOf Of hoJsonResponse "first" To iFirst
    Get ComIntOf Of hoJsonResponse "numberOfElements" To iNumberOfElements
    Move 0 To i
    Get ComSizeOfArray Of hoJsonResponse "content" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJsonResponse To i
        Get ComStringOf Of hoJsonResponse "content[i].id" To sId
        Get ComStringOf Of hoJsonResponse "content[i].sender.description" To sSenderDescription
        Get ComStringOf Of hoJsonResponse "content[i].sender.countryCode" To sSenderCountryCode
        Get ComStringOf Of hoJsonResponse "content[i].sender.vatCode" To sSenderVatCode
        Get ComStringOf Of hoJsonResponse "content[i].sender.fiscalCode" To sSenderFiscalCode
        Get ComStringOf Of hoJsonResponse "content[i].receiver.description" To sReceiverDescription
        Get ComStringOf Of hoJsonResponse "content[i].receiver.countryCode" To sReceiverCountryCode
        Get ComStringOf Of hoJsonResponse "content[i].receiver.vatCode" To sReceiverVatCode
        Get ComStringOf Of hoJsonResponse "content[i].receiver.fiscalCode" To sReceiverFiscalCode
        Get ComStringOf Of hoJsonResponse "content[i].invoiceType" To sInvoiceType
        Get ComStringOf Of hoJsonResponse "content[i].docType" To sDocType
        Get ComStringOf Of hoJsonResponse "content[i].file" To sFile
        Get ComStringOf Of hoJsonResponse "content[i].filename" To sFilename
        Get ComStringOf Of hoJsonResponse "content[i].username" To sUsername
        Get ComStringOf Of hoJsonResponse "content[i].lastUpdate" To sLastUpdate
        Get ComStringOf Of hoJsonResponse "content[i].idSdi" To sIdSdi
        Move 0 To j
        Get ComSizeOfArray Of hoJsonResponse "content[i].invoices" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJsonResponse To j
            Get ComStringOf Of hoJsonResponse "content[i].invoices[j].invoiceDate" To sInvoiceDate
            Get ComStringOf Of hoJsonResponse "content[i].invoices[j].number" To sNumber_str
            Get ComStringOf Of hoJsonResponse "content[i].invoices[j].status" To sStatus
            Move j + 1 To j
        Loop

        Move i + 1 To i
    Loop



End_Procedure

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
}