How to set the value of a File/Image Upload File - Forum - Rollbase - Progress Community

How to set the value of a File/Image Upload File


How to set the value of a File/Image Upload File

This question is answered
Hi Guys,
I have a similar problem as listed in the post below
I need to create records in a different Rollbase tenant, for this I’m using the REST method
I need to create an image file as well as an upload file, is there a way to achieve this?
Verified Answer
All Replies
  • After you create the record using the REST api createRecord() you should be able to get the record's ID. At this point you would need to make another REST call using either the setBinaryData() [] or setDataField() [] methods.

    Both methods would require the file's Base-64 encoded binary value of file, the record's id, content type, and file name at least.

    I would suggest using the POST method rather than GET for file uploads as you might run into the maxHTTPParameter limit.

    Hope this helps.

  • Hi,
    Thanx for the feedback.
    I’ve been playing around with the REST methods, and for some reason I’m running into some problems.
    I’m using the REST method called create, to create a record in another Rollbase tenant.
    When I include the values as URL parameters it works fine,
    But as soon as I try sending the values as XML I keep getting  the below Error. (Even though my XML seems correct)
    Error in thread catalina-exec-595 at 02/03/2017 11:10 AM: Error: Cannot parse XML document
    Using the same XML, I am able to create the records using SoapUI
    Is there perhaps a sample app somewhere, making use of the create and setBinaryData methods somewhere that I can look at?
  • Hi,
    I managed to get this working, but I had to resort to using the SOAP methods instead.
    The setBinaryData() method seemed to have done the trick.
    There seems to be a limitation on the HttpPost Trigger as it does not allow Tokens in the URL.
    This meant I could not pass the sessionId to subsequent methods after login in.
    Thanks again,