Sending a file over http POST
I am having trouble figuring out how to send a pdf file to the /transientDocuments REST API. In what format should it be in? what do I need to include in the headers and body? I can never find a clear answer.
I am having trouble figuring out how to send a pdf file to the /transientDocuments REST API. In what format should it be in? what do I need to include in the headers and body? I can never find a clear answer.
I figured it out! I will post the solution for others looking.
In order to send a pdf over HTTP /POST, I set the header to have the access token. However, I set the body to be
"-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"File\"; filename=${fileBase64}\r\nContent-Type: application/pdf\r\n\r\n\r\n-----011000010111000001101001--"
Where the 'fileBase64' variable is my file that I converted into a Base64 string.
I also set the Content-Type to be "multipart/form-data; boundary=---011000010111000001101001"
I was able to figure it out by using Postman application to observe what was sent between the Adobe server and the application. Postman also had sample code in Java (and many other languages) that proved to be invaluable when I was trying to figure out a solution.
Hope this helps someone else.
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.