NULL PDF Exception

This article was translated from English: Does it need improvement?
Translated
View the article in English

The "ERROR-001" error occurs when there is no PDF file provided. This means that the required pdf_file parameter in the POST request was null or empty.

Por favor notaBe sure to check the parameter syntax, the file path of the PDF file, or the validity of the PDF stream.

ConsejosEnsure the pdf_file parameter is set to your PDF file in the POST request.

Example of pdf_file proper syntax in cURL:

curl -X POST 'https://api.securedoc.com/v1/document-services/pdfs/redact-text?words_to_redact=IRON' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@YOUR_PDF_DOCUMENT.pdf;type=application/pdf'
curl -X POST 'https://api.securedoc.com/v1/document-services/pdfs/redact-text?words_to_redact=IRON' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@YOUR_PDF_DOCUMENT.pdf;type=application/pdf'
SHELL

Refer to the final line for proper usage:

-F 'pdf_file=@YOUR_PDF_DOCUMENT.pdf;type=application/pdf'

Explanation

  • -X POST: Specifies the request method as POST.
  • URL: The API endpoint URL that processes the PDF document.
  • -H 'accept: */*': Header indicating the server can respond with any content type.
  • -H 'Content-Type: multipart/form-data': This header specifies that the POST request contains a form with data, which can be files and parameters.
  • -F 'pdf_file=@YOUR_PDF_DOCUMENT.pdf;type=application/pdf': This flag uploads a file; the @ symbol before the file name indicates that the name after the @ is a file path. The type=application/pdf ensures that it is treated as a PDF.

Make sure that the path to YOUR_PDF_DOCUMENT.pdf exists and points to the actual PDF file you want to use.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Versión: 2024.10 recién lanzado