Rest Api - Retrieve file - Forum - Rollbase - Progress Community

Rest Api - Retrieve file

 Forum

Rest Api - Retrieve file

This question is answered

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? :/

Verified Answer
  • Thanks for your info. Tracking defect as PSC00318938

All Replies
  • Are you using REST API?

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

  • 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

  • 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.

  • Are you using File Upload or Image field?

  • Please also provide URL you're using

  • 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

  • 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?


    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.

  • 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.

  • 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.

  • Thanks for your info. Tracking defect as PSC00318938