Return Binary PDF from PreS Connect API

Hi,

Is it at all possible to get the PReS connect REST API to return a Binary PDF in a HTTP response? The use case is we running a serverless automated application in AWS that takes client data, runs it through out template/datamapper/output and is outputting it locally on our server. We currently have this working, but we would like the option to be able to store these PDF’s in S3 buckets also.

The other option would be is there some type of webhook or service that can send a request off when the PDF has generated, we can get our serverless functions to reach into a certain location on our server at the moment, but we need some sort of conformation that the API has indeed created the PDF.

Thanks

So you can use this endpoint /rest/serverengine/workflow/print/getProgress/ to get the progress will return and number which indicates the % finished or the string done.

Youe can use this endpoint /rest/serverengine/workflow/print/getResult/ to get back PDF binary (there may even be another getResult in one of the other endpoint categories), however there is a slight gotcha. It seems you can only do it once. I tried setting all the template,mapper,output upload to ?persistent=true but this makes no difference. Once you do the getResult you cannot get the result or progress again.

I guess you are looking for the getManagedResult end point. This returns the Managed File ID of the final result of a completed Output Creation operation of a specific operation ID. The output sits in Connect’s File Store and can be downloaded in a subsequent request using the File Store api.

Erik

/rest/serverengine/workflow/print/getManagedResult/{operationId}

https://help.objectiflune.com/en/planetpress-connect-rest-api-cookbook/2021.1/#Cookbook/REST_API_Reference/All-In-One_Service/Get_Managed_Result_of_Operation.htm

/rest/serverengine/filestore/file/{fileId}

https://help.objectiflune.com/en/planetpress-connect-rest-api-cookbook/2021.1/#Cookbook/REST_API_Reference/File_Store_Service/Download_Managed_File_or_Directory.htm

Hi Erik,

Thanks for getting back to me. Once I have the fileID I can hit the filestore/file as many times as I want to get the response until cleanup happens. However, getManagedResults seems as though it will only return the response once. Is this the expected behaviour of the endpoint?

Thanks

Tim

Hi Tim,

Yes, this is expected behavior.

Erik