Create file
Requirements
- Authentication token
How to:
1. Create a file
POST /files/saveFile?token=:authenticationToken
- Creates new file from BLOB.
- This request uses Content-Type: multipart/form-data.
Example
Request
POST /files/saveFile?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
"fileName": "My file",
"file": blob //File blob
}
Response
{
"file": {
"checksum": "f898ee89406adbb65fffcf08bc19e3b70d27ae189510077c394d382c578ee074a26a3ca24a35f3bd8898ac0951ae63e5e0e3654184b956d86707c925d697f730",
"documentname": "My file",
"encoding": "7bit",
"fileExtension": "pdf",
"fileId": "w3buldjaekdrigei0uaz8yahmfc1f90cco67wykfuja48uqgi60anzex9lw42sfl",
"fileType": "pdf",
"hash": "w3buldjaekdrigei0uaz8yahmfc1f90cco67wykfuja48uqgi60anzex9lw42sfl",
"mimetype": "application/pdf",
"originalname": "file.pdf",
"revision": 1,
"size": 818513
},
"storage": { "limit": 1073741824, "used": 818513 }
}
- Response object contains the file hash of newly created file: w3buldjaekdrigei0uaz8yahmfc1f90cco67wykfuja48uqgi60anzex9lw42sfl
2. Detect sign fields in file
POST /files/saveFile?token=:authenticationToken
- Creates new file from BLOB.
- Detects existing file sign fields and checks password.
- Uses Content-Type: multipart/form-data.
Example
Request
POST /files/saveFile?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
"fileName": "My signature file",
"checkSignFields": true,
"file": blob //File blob
}
Response
{
"file": {
"checksum": "2224858ae9634aa26d2420c7c21afe74cfa099fe2517240809216ec45c8b2c4e4224a8520fadaeca2b85d25eb8406b95b4055e1f748965d747154f0b500264f8",
"documentname": "Signature Fields File",
"hash": "sdf1rsd2t98syxv1pi3iz213wqwv1g5j1u6k9t8jt1gf3d0set1zt0erqk12jgf5",
…
},
"storage": { "limit": 1073741824, "used": 57380 },
signFields: [ //two sign fields found
{
id: 'signer-1',
position: { //position on page
percentX: 0.17134105,
percentY: 0.2282968,
percentWidth: 0.20997676,
percentHeight: 0.046324354
},
type: 'signature',
timestamp: false,
bold: false,
page: [ 2 ],
required: false
},
{
id: 'signer-2',
position: {
percentX: 0.6458885,
percentY: 0.2282968,
percentWidth: 0.20997676,
percentHeight: 0.046324354
},
type: 'signature',
timestamp: false,
bold: false,
page: [ 2 ],
required: false
}
]
}
- Response object contains the file hash of newly created file and information about sign fields.