Answer the question
In order to leave comments, you need to log in
How to use 3rd party rest api in rails?
I'm trying to use some api on the page.
I want to send a post to site/api/token
with login and password parameters
, the response should be json with a token
that can be used in other get requests to this host
require 'net/http'
require 'uri'
uri = URI.parse('http://site/api/token')
response = Net::HTTP.post_form(uri, {'User'=>'myname', 'Pass'=>'mypass'})
Answer the question
In order to leave comments, you need to log in
In the production logs I do not see any records of successful or unsuccessful requests
. And how to save the incoming token?
like:@token = JSON.parse(res.body)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question