Hello all,
I’m new to the JSON and REST modules, and i’m struggling to send the
following payload information as a post method:
url: ‘http://site.local/trim/v1/config/login’
method: post
request header: Content-Type:xxxx/xxx+json
payload:
{
“login”:
{
“username”:“admin”,
“password”:“secret”
}
}
code:
require ‘JSON’
require ‘rest-client’
post = RestClient.post(url, {:params => {login => ‘username’,‘admin’,
‘password’,‘secret’}}, {“Content-Type” => “application/tribapte” })
puts post.args[:payload][:params]
The problem is that the ‘:params’ are not matching the ruby hash
structure, so this code will never run successful.
Hopefully someone can guide me trough the process
of successfully post the payload as mentioned above.
Thanks in advance!
iLias