Rest API Call setBinaryField() for sending attachment to Rollbase - Forum - Rollbase - Progress Community

Rest API Call setBinaryField() for sending attachment to Rollbase

 Forum

Rest API Call setBinaryField() for sending attachment to Rollbase

This question is answered

Hello,

I am trying to send an attachment (.pptx) to Rollbase via REST API call. I am using the setBinaryField api call to perform this task and the string that I am using is given below:

updateRecordStr = ServerStr & "/rest/api/setBinaryField?sessionId=" & sessionID & "&id=" & recordIDStr & "&fieldName=file&value=" & attachStr & "&fileName=xyz.pptx" "&contentType=application/vnd.openxmlformats-officedocument.presentationml.presentation"

Is the above given string ok? Because when I am performing an HTTP send, my application stops working.

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Open "POST", FullURLPath, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.Send ("")

I am also getting an error: Unknown API for POST request setBinaryField. Do you guys find any problem with the API?

Verified Answer
  • Hi Iramk,
     
    Take a look.. it is working…
     
    Remember to update for your sessionid, field name, id and etc…
     
    Regards,
    Ricardo
     
     
     
     
All Replies
  • same error even after removing the ? from the URL..

  • Tried using SOAP 5.0.0. Getting a URI too large error.

  • Are you sending long file? If so, it may be necessary to use multipart HTTP calls.

  • Yes I am sending a long file. could you please provide an example of the multipart HTTP call?

  • Actually REST API has name setBinaryData, not setBinaryField. That's why you're having error "Unknown API".

  • Yes I know, I tried setBinaryData... same result. (don't get the error anymore) but still get the No URL parameter sessionId.

  • Are you also getting " Unknown API for POST request" error when using setBinaryData API?

  • "No URL parameter sessionId" seems like a different problem. I think server cannot read your HTTP request and extract URL parameters.

  • Hi Iramk,
     
    Take a look.. it is working…
     
    Remember to update for your sessionid, field name, id and etc…
     
    Regards,
    Ricardo
     
     
     
     
  • Btw Ricardo, thanks for that URLEncode function, that is the function that I wasn't using in my code that has made it work for smaller files. By the way I would like to mention that I am using a Trial account of Rollbase, I'm not sure if that affects it or not. The problem still persists for larger files i.e. I still get the error: 'No URL parameter "sessionId"' (for larger files). Would the larger file upload be related to me using a Trial account?

    The maximum file size I am able to achieve is about 1.3 MB. Anything above that just returns back with the above mentioned error.

  • No IramK,

    Did you get this error using VBA or SOAPUI?

    Using SOAPUI you have to check the Option "Controls if query-parameters should be put in message body" (option next to Media Type.

  • Hi IramK,

    In the Public Cloud (Rollbase.com),  there is a limit of 2MB for File upload.

  • Yes so all makes sense now. The 2MB limit and the URL encoding. It works now.