-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Merge PDFs with API call #2502
Comments
Hey @hal-berto! I'm here to help you with any bugs, questions, or contributions. Let's work together to resolve this issue. The error you're encountering suggests that the curl -X POST \
'https://stirlingpdf.io/api/v1/general/merge-pdfs' \
-H 'accept: */*' \
-H 'Content-Type: multipart/form-data' \
-F 'fileInput=@path_to_file_1.pdf' \
-F 'fileInput=@path_to_file_2.pdf' \
-F 'sortType=orderProvided' \
-F 'isRemoveCertSign=true' \
-H 'Authorization: Bearer YOUR_API_KEY' Key points to note:
Make sure to replace To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Hi @hal-berto try this: windows prompt curl -X POST "http://127.0.0.1:8080/api/v1/general/merge-pdfs" ^
-H "accept: */*" ^
-H "Content-Type: multipart/form-data" ^
-F "fileInput=@path_to_file_1.pdf" ^
-F "fileInput=@path_to_file_2.pdf" ^
-F "sortType=orderProvided" ^
-F "removeCertSign=false" ^
--output path_to_file_3.pdf linux terminal curl -X POST "http://127.0.0.1:8080/api/v1/general/merge-pdfs" \
-H "accept: */*" \
-H "Content-Type: multipart/form-data" \
-F "fileInput=@path_to_file_1.pdf" \
-F "fileInput=@path_to_file_2.pdf" \
-F "sortType=orderProvided" \
-F "removeCertSign=false" \
--output @path_to_file_3.pdf |
Many thanks. The missing part was the "@" character before the file path. Now it's working properly |
Installation Method
None
The Problem
Greetings,
I'm trying to implement a call to StirlingPDF APIs to merge different PDF documents (I'm referring to API /general/merge-pdfs).
I tried with the following cURL calls:
curl -X 'POST'
'https://stirlingpdf.io/api/v1/general/merge-pdfs'
-H 'accept: /'
-H 'Content-Type: multipart/form-data'
-F 'fileInput=path_to_file_1.pdf'
-F 'fileInput=path_to_file_2.pdf'
-F 'sortType=orderProvided'
-F 'removeCertSign=true'
and this variation:
curl -X 'POST'
'https://stirlingpdf.io/api/v1/general/merge-pdfs'
-H 'accept: /'
-H 'Content-Type: multipart/form-data'
-F 'fileInput[]=path_to_file_1.pdf'
-F 'fileInput[]=path_to_file_2.pdf'
-F 'sortType=orderProvided'
-F 'removeCertSign=true'
In both cases I receive an error:
"Bad Request","exception":"org.springframework.web.bind.MethodArgumentNotValidException","trace":"org.springframework.web.bind.MethodArgumentNotValidException: Validation failed for argument [0] in public org.springframework.http.ResponseEntity<byte[]> stirling.software.SPDF.controller.api.MergeController.mergePdfs(stirling.software.SPDF.model.api.general.MergePdfsRequest) throws java.io.IOException: [Field error in object 'mergePdfsRequest' on field 'fileInput': rejected value [Array]; codes [typeMismatch.mergePdfsRequest.fileInput,typeMismatch.fileInput,typeMismatch.[Lorg.springframework.web.multipart.MultipartFile;,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [mergePdfsRequest.fileInput,fileInput]; arguments []; default message [fileInput]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile[]' for property 'fileInput'; Cannot convert value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile' for property 'fileInput[0]': no matching editors or conversion strategy found]
I know for sure that the file path is correct, since I succesfully called other StirlingPDF APIs with the same path.
Is there something wrong with my cURL?
Version of Stirling-PDF
0.36.4
Last Working Version of Stirling-PDF
No response
Page Where the Problem Occurred
No response
Docker Configuration
No response
Relevant Log Output
Additional Information
No response
Browsers Affected
No response
No Duplicate of the Issue
The text was updated successfully, but these errors were encountered: