Skip to main content

How to save a PDF to a document via the API?

Attaching a PDF to an Invoice Using cURL

Written by Petr Pech

A PDF (or any other file) is added to a document with a PUT request to the prilohy sub-inventory. The attachment name is determined by the last part of the address.


Request

PUT /c/{firma}/faktura-prijata/1/prilohy/new/Faktura-PF1_0001.pdf
Content-Type: application/pdf

(tělem požadavku je samotný soubor)

The same request using cURL:

curl -u uzivatel:heslo -k -L -X PUT \
-H "Content-Type: application/pdf" \
-T Faktura-PF1_0001.pdf \
"https://server:5434/c/{firma}/faktura-prijata/1/prilohy/new/Faktura-PF1_0001.pdf"

A successful upload is confirmed by the 201 response. Files are attached to any inventory that supports attachments in the same way — just specify a different inventory and record identifier instead of faktura-prijata/1.

ℹ️ Uploading a PDF does not trigger the document import — the file is only attached. To create a document from a received invoice in PDF or ISDOC format, send it directly to the inventory with the typDokl parameter, as described in the article cURL command for importing data into the application.


Related

Did this answer your question?