Rest Api - Retrieve file

Posted by matman on 03-Nov-2014 10:22

I am using getBinaryData to retrieve a .jpg file from my application. When I access this command via my browser, using manual login etc. I receive an error stating that the image is corrupted. I figured the content could be compressed, but gzip and deflate decompression didn't work for me either. I was unable to decode it as base64 string as well. So how could I achieve this? :/

Posted by pvorobie on 05-Nov-2014 10:55

Thanks for your info. Tracking defect as PSC00318938

All Replies

Posted by pvorobie on 03-Nov-2014 10:24

Are you using REST API?

Posted by matman on 03-Nov-2014 10:26

Yes, I am using the Rest Api and the public Rollbase hosted by Progress

Posted by pvorobie on 03-Nov-2014 11:30

REST API getBinaryData will send back actual binary data (from previously uploaded file) with valid content type. I just tested this API, sample URL:

http://localhost:8080/rest/api/getBinaryData?objName=hierarchy&id=491765&fieldName=my_file&sessionId=ef111e4d0c5b4de183a4bd5cf541622f@5903

Posted by matman on 04-Nov-2014 02:40

I have been trying, but I really can't seem to open the image. The image is viewable from Rollbase itself, but not via the browser when I manually input the API URL nor is it via Fiddler.

Posted by pvorobie on 04-Nov-2014 11:01

Are you using File Upload or Image field?

Posted by pvorobie on 04-Nov-2014 11:01

Please also provide URL you're using

Posted by Godfrey Sorita on 04-Nov-2014 13:18

Hi matman,

I was able to render both file and image upload on Firefox. The test was also done on the hosted cloud using the link below:

www.rollbase.com/.../getBinaryData

I got this result from Fiddler:

Regards,

Godfrey

Posted by matman on 05-Nov-2014 02:23

I added a new file upload field and was able to successfully retrieve the image without an error. Apparently the file field I used to upload, uploads files encrypted. I cannot find any information about decrypting the file on my side or retrieving the file decrypted by the server, is there any way I could do so?


[mention:05b5f00eae4a468d844fa8bedcafd110:e9ed411860ed4f2ba0265705b8793d05] I used URL: http://rollbase.com/rest/api/getBinaryData?sessionId=857bfcdfc9824b6982b9b49636ed5572@108169344&id=113986842&objName=website3&fieldName=file . Field with integration name "file" is a file upload field. But I found out I told it to encrypt all uploaded files a long time ago.

Posted by pvorobie on 05-Nov-2014 10:29

So are you saying that REST API does not decrypt encrypted file? Just to make sure. Files should definitely be decrypted before being retrieved by API.

Posted by matman on 05-Nov-2014 10:38

Yes indeed. I was able to retrieve the image from the upload field, but when I checked encrypt and reuploaded the same image, I got the corrupted image error again.

Posted by pvorobie on 05-Nov-2014 10:55

Thanks for your info. Tracking defect as PSC00318938

This thread is closed