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

 Forum

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?
 
Regards,
http://www.aigs.co.za/templates/email_signatures/2016/stephen_van_rooyen.png
 
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() [http://documentation.progress.com/output/rb/doc/index.html#page/rb%2Fsetbinarydata.html%23] or setDataField() [http://documentation.progress.com/output/rb/doc/index.html#page/rb%2Fsetdatafield.html%23] 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: com.rb.rest.services.system.RestException: 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?
     
    Regards,
    http://www.aigs.co.za/templates/email_signatures/2016/stephen_van_rooyen.png
     
  • 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,
     
    Regards,
    http://www.aigs.co.za/templates/email_signatures/2016/stephen_van_rooyen.png