ruby on rails - how to get the httparty call return something inside an array -
[{"id"=>1015765, "date"=>"/date(1468062000000+0100)/", "eventgroupname"=>"electric daisy carnival", "venuename"=>"milton keynes bowl", "town"=>"milton keynes", "country"=>"uk", "ticketcount"=>35, "currency"=>"gbp", "minprice"=>79.75, "layoutid"=>3932, "eventgroupid"=>32347, "venueid"=>3596}] i'm getting response form api im calling
how go getting id use elsewhere in controller???
heres controller
api = httparty.get("url here").parsed_response id = api["events"] i have tried sticking [id] on end of id call didnt work.
sam
additional
heres tried :)
id = api["events"].first["id"] results = httparty.get("partoneofurl" + id + "parttwoofurl") syntax error, unexpected tidentifier, expecting ')' syntax error, unexpected ')', expecting keyword_end
the result of httparty call array contains hash table response elements. access these values need first access hash table, array's first element , can access values in hash table. can in way:
$ api.first["key"]
Comments
Post a Comment