Backendless Support
 
Answered

Getting raw request body string

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'?

Leave a Comment

Comments (6)

photo
1

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

photo
1

Can't I use other formats than JSON?

photo
1

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

29777e6f5d1260a9cf64dfead948454a

bf05a88c1e33f140af317590f018b372

photo
1

not work with this body:

  1. myStringMethodBody{"myStringMethodBody"}

I got just

  1. myStringMethodBody{

as return.

photo
1

try this

  1. myStringMethodBody{\"myStringMethodBody\"}

photo
1

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

Thank you anyway.

photo