Trying to add header in the request
email = "[email protected]"
token = "abcdefghijk"
url = "http://www.somewebsite.com/request?params1=value1¶ms2=value2"
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port).start
request = Net::HTTP::Get.new(uri.request_uri)
request['email'] = email
request['token'] = token
response = http.request(request)
render json: response.body
The results i have gotten back is {"error":"invalid request parameters"}
I am supposed to get back a list of data in json. I tried using postman to test if the url is working and passed the email and token inside header and i got back the data that i wanted. I am not sure where it went wrong with the code. Can anybody advise me which part did i do wrongly? Thanks a lot!