Ruby - API RestClient - JSON -
just getting started api testing , struggling, used doing front end selenium web-driver tests, however, need head around api testing.
i kind of understand basics such get data url , post post data url, think correct, however, wrong.
the issue having below:
response = restclient.post 'http://jsonplaceholder.typicode.com/posts', {:title => 'mr', :first_name => 'bob', :second_name => 'smith'} data1 = json.parse(response) p data1
so assigning restclient.post response variable , posting hash key, value pairs url? using json parse response , printing response console. need extract each value hash , print each value console shows data mr bob smith. instead of {:title => 'mr', :first_name => 'bob', :second_name => 'smith'}
print "#{ data1[ :title ]} #{data1[:first_name]} #{data1[:second_name]}"
Comments
Post a Comment