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 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
版本: 2024.10 剛剛發布