rbf_sendHttpRequest Unsupported media type error - Forum - Rollbase - Progress Community

rbf_sendHttpRequest Unsupported media type error

 Forum

rbf_sendHttpRequest Unsupported media type error

This question is answered

Hi,

I have been trying to make a call to a webservice from javascript in rollbase using rbf_sendHttpRequest but I keep on getting "Unsupported media type". I saw that the call from the browser for rbf_sendHttpRequest has "application/xml" but I want to get the response from a DataObject service which uses application/json.
Previously we did this calls using progress.data.Session, but we added user authentication and we also have to send the ClientPrincipal using CP_TOKEN.
We need to get some data that could have been changed by the user on the UI so we have to use some client side code.
Is there any way I can make the call with rbf_sendHttpRequest or is there another solution?

Best regards,

Dora

Verified Answer
  • Hi,

    In the end I figured it out I was missing a header. I only used "Accept" as in this example: www.progress.com/.../client-side-rest-invocations-in-rollbase. But what I needed actually was also "Content-Type" :"application-json".

    I added this header and  "X-OE-CLIENT-CONTEXT-ID" : "{!#CP_TOKEN}" for client principal info and now it seems to be working.

All Replies
  • Are you adding any headers like Content-Type? Please share the call sample that you are making

  • Hi,

    In the end I figured it out I was missing a header. I only used "Accept" as in this example: www.progress.com/.../client-side-rest-invocations-in-rollbase. But what I needed actually was also "Content-Type" :"application-json".

    I added this header and  "X-OE-CLIENT-CONTEXT-ID" : "{!#CP_TOKEN}" for client principal info and now it seems to be working.