Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dobby1
Contributor III
Contributor III

Send PDF file in tRestClient PUT body

I'm using the Adobe PDF Services API and trying to do a PUT via tRestClient and need to include a pdf file in the body but nothing I've tried so far has worked. Below is the REST API CURL found in the documentation. How do I achieve the inclusion of the PDF file which is referenced in the --data-binary '@{{Placeholder for file path}}'?

https://developer.adobe.com/document-services/docs/overview/pdf-services-api/gettingstarted/

curl --location -g --request PUT 'https://dcplatformstorageservice-prod-us-east-1.s3-accelerate.amazonaws.com/b37fd583-1ab6-4f49-99ef-...{Placeholder for X-Amz-Security-Token}}&X-Amz-Algorithm={{Placeholder for X-Amz-Algorithm}}&X-Amz-Date={{Placeholder for X-Amz-Date}}&X-Amz-SignedHeaders={{Placeholder for X-Amz-SignedHeaders}}&X-Amz-Expires={{Placeholder for X-Amz-Expires}}&X-Amz-Credential={{Placeholder for X-Amz-Credential}}&X-Amz-Signature={{Placeholder for X-Amz-Signature}}' \
--header 'Content-Type: application/pdf' \
--data-binary '@{{Placeholder for file path}}'

Labels (1)
  • REST

4 Replies
Rahul_Kale
Support
Support

Hello Dobby1,

 

Thank you for reaching out to the Qlik community.
 

In the Adobe PDF Services flow, PUT is a plain binary upload to a pre‑signed S3 URL. In tRestClient, you must send the PDF as raw binary bytes in the request body, not as multipart/form‑data.

You can refer to this article, which gives detailed information about the same.

Dobby1
Contributor III
Contributor III
Author

Hi,

 

Thank you. I have tried the tHTTPClient but still no success. I looked as it the component was changing "&" to "&amp" in the URL so I applied java.net.URLEncoder.encode() to the path. The error I'm receiving now is:

<Error><Code>KeyTooLongError</Code><Message>Your key is too long</Message><Size>1830</Size><MaxSizeAllowed>1024</MaxSizeAllowed>

 

I don't know what key it is referring to or how to fix it.

Rahul_Kale
Support
Support

Why are you getting KeyTooLongError:

  • You URL‑encoded the presigned URL.
  • That breaks Adobe/AWS S3 presigned URLs.
  • S3 then treats the whole query string as the object key → too long → error.

What not to do:

  • Do not use URLEncoder.encode()
  •  Do not modify the URL at all
  • Do not “fix” &amp;

What to do instead:

  •  Use the exact presigned URL from Adobe
  •  Make sure it contains real &, not %26
  • Put the URL in a Talend context variable (prevents XML escaping)
  • Send the PDF as binary body
  • Header: Content-Type = application/pdf

Talend (tHttpRequest / tRestClient):

  • Method: PUT
  • URL: context.presignedUrl
  • Body: Binary → PDF file
  • Headers: only Content-Type

That’s it.

If you still get errors, check that the outgoing request URL shows &X-Amz-... (not %26X-Amz-...).

Dobby1
Contributor III
Contributor III
Author

Hi Rahul,

 

I tried the options you suggested but it appears that the tHTTPClient is changing the URL that is being sent. I observed that the response body had "&" replaced with "&amp". That caused an error message indicating that the SignatureProvided does not match no longer appears.

I have a case opened with Qlik.