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.

请注意Be sure to check the parameter syntax, the file path of the PDF file, or the validity of the PDF stream.

提示Ensure 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
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
版本: 2024.10 刚刚发布