downloadInbox()


Fatture ricevute (XML): metodo per effettuare una ricerca in base all'ID fattura, identificativo SdI, ricerca per range di date e per scaricare il Pacchetto di Distribuzione (PDD).

{warning} Se non vengono passati i suddetti parametri opzionali, verrĂ  creato un PDD con tutte le proprie fatture ricevute (XML).


{info} Se disponibili, nel PDD prodotto verranno inclusi anche i PDF di cortesia e ministeriali.

Endpoint

Method URI
POST https://fatture.keliweb.it/api/download-inbox

Request Parameters

Parameter Type Description Required
HTTP headers: Authorization string Bearer + the token to access APIs Yes
invoiceId integer ID univoco della fattura (relativo al DB locale) optional
identificativoSdI integer ID univoco della fattura dato dal SDI optional
start_date date data iniziale ricerca per range optional; date_format: "Y-m-d"
end_date date data finale ricerca per range optional; date_format: "Y-m-d"
is_read boolean se presente, filtra le fatture ricevute per lette/non lette optional

Response Parameters

Parameter Type Description
pdd string pacchetto di distribuzione (PDD) da scaricare, codificato in base64

Example Request (BASH Curl)

curl --location --request POST 'https://fatture.keliweb.it/api/download-inbox' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImYxYTAzNzMzYzY5ZDQ3' \
--form 'invoiceId="1"'

Example Request (PHP Curl)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://fatture.keliweb.it/api/download-inbox',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('invoiceId' => '1'),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImYxYTAzNzMzYzY5ZDQ3ZDUxZDFiNTA2M'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Example Request (jQuery AJAX)

var form = new FormData();
form.append("invoiceId", "1");

var settings = {
    url: "https://fatture.keliweb.it/api/download-inbox",
    method: "POST",
    timeout: 0,
    headers: {
        Authorization:
            "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImYxYTAzNzMzYzY5ZDQ3ZD"
    },
    processData: false,
    mimeType: "multipart/form-data",
    contentType: false,
    data: form
};

$.ajax(settings).done(function(response) {
    console.log(response);
});

Example Request (Python - Requests)

import requests

url = "https://fatture.keliweb.it/api/download-inbox"

payload={'invoiceId': '1'}
files=[

]
headers = {
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImYxYTAzNzMzYzY5ZDQ3ZDUxZDFiN'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

Example Response (JSON payload)

{
    "pdd": "UEsDBBQAAgAIAEBbVVO3LB/05gQAAF8QAAAXAAAASVQwMzI4MTMyMDc4Ml8wMDAwMS54bWzFWFtz4j"
}