How to send data as json object in post method of Rho::AsyncHttp
I sending data to a server using the Rho::AsyncHttp.post method, but i'm
unable to send the data as json object. But sending the data as string
reaches the server but the server api requires json data.
Here the code i'm using,
data = { :query1 => "this demo" , :query2 => "another demo" }
result = Rho::AsyncHttp.post(
:url => "https://www.myserverapi.com/myapi",
:body => data
)
The above code fails to connect to server. How ever when i change the
:body => #{data}, its reaches the server but as string. Ant suggestion?
No comments:
Post a Comment