uploadPDD()


Metodo per caricare i pacchetti di distribuzione (PDD) in formato file ZIP, migrazione da Entaksi.

Endpoint

Method URI
POST https://fatture.keliweb.it/api/upload-pdd

Request Parameters

Parameter Type Description Required
HTTP headers: Authorization string Bearer + the token to access APIs Yes
attachments array Array di file, max 25 file per Request Yes
attachments.* file Il file in formato ZIP, max 25MB ciascuno Yes
pddType string Tipo di PDD: D01 (fatture attive), D02 (fatture passive) Yes

Response Parameters

Parameter Type Description
status string risultato dell'operazione (success / errors)
message string dettagli sul risultato dell'operazione
sha256 string fingerprint del file, in formato SHA256
filename string nome originale del file caricato a sistema
path string se presente, indica la directory di salvataggio del file

Example Request (BASH Curl)

curl --location --request POST 'https://fatture.keliweb.it/api/upload-pdd' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImU1Nzk3OD' \
--form 'pddType="D01"' \
--form 'attachments[]=@"/home/user/Downloads/D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip"' \
--form 'attachments[]=@"/home/user/Downloads/D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip"'

Example Request (PHP Curl)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://fatture.keliweb.it/api/upload-pdd',
  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('pddType' => 'D01','attachments[]'=> new CURLFILE('/home/user/Downloads/D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip'),'attachments[]'=> new CURLFILE('/home/user/Downloads/D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip')),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImU1Nz'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Example Request (jQuery AJAX)

var form = new FormData();
form.append("pddType", "D01");
form.append(
    "attachments[]",
    fileInput.files[0],
    "D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip"
);
form.append(
    "attachments[]",
    fileInput.files[0],
    "D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip"
);

var settings = {
    url: "https://fatture.keliweb.it/api/upload-pdd",
    method: "POST",
    timeout: 0,
    headers: {
        Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Im"
    },
    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/upload-pdd"

payload={'pddType': 'D01'}
files=[
  ('attachments[]',('D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip',open('/home/user/Downloads/D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip','rb'),'application/zip')),
  ('attachments[]',('D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip',open('/home/user/Downloads/D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip','rb'),'application/zip'))
]
headers = {
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImU1Nzk3OD'
}

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

print(response.text)

Example Response (JSON payload)

[
    {
        "status": "success",
        "message": "D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip caricato/i correttamente.",
        "filename": "D02_urn_entaksi_IT03281320782__default_pdd_38711_1.zip",
        "sha256": "f887d8ac52ef82a00e6699ea0f3e0346e23fe7a4145523eeaf646414af5dcb46",
        "path": "folder/21564/D01/20211022",
        "pdd_id": 2,
        "errors": false
    },
    {
        "status": "warning",
        "message": "D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip giĆ  caricato/i sui nostri sistemi.",
        "errors": true,
        "sha256": "c493c31a2e18df79d7e3988bd83d0ae7a22bbefd0a1ea8135a0119014fc3f4e5",
        "filename": "D01_urn_entaksi_IT03281320782__default_pdd_38710_1.zip"
    }
]