Support Topics Documentation Slack YouTube Blog

Getting raw request body string


(Dongwoon Son) #1

I want to get raw request body string in api services.
A service method with one argument cannot get json string like {“a”:“b”}.
Can you add ‘httpBody’ to ‘InvocationContextDTO’?


(Mark Piller) #2

Why don’t you declare a method which takes one argument of type Object? Then you can send any JSON as the method argument.

Regards,
Mark


(Dongwoon Son) #3

Can’t I use other formats than JSON?


(Vladimir Upirov) #4

yes, you can use String

if you define only one parameter and it is String, you can send to the Service-Method a simple string

http://support.backendless.com/public/attachments/29777e6f5d1260a9cf64dfead948454a.png</img>

http://support.backendless.com/public/attachments/bf05a88c1e33f140af317590f018b372.png</img>

29777e6f5d1260a9cf64dfead948454a.png


(Dongwoon Son) #5

not work with this body:

myStringMethodBody{"myStringMethodBody"}

I got just

myStringMethodBody{

as return.


(Vladimir Upirov) #6

try this

myStringMethodBody{\"myStringMethodBody\"}

(Dongwoon Son) #7

If that is the only way, it would be difficult to maintain compatibility with my existing clients.
Thank you anyway.