[英]Converting curl api call to httparty
I am fairly new to Httparty and I would like to do user auth through httparty. 我是Httparty的新手,我想通过httparty进行用户身份验证。 The command in curl works.
curl中的命令有效。
curl --data "username=USERNAME&password=PASSWORD&token=132321212" 'https://hekki.isks.com/api/userauth'
I can't quite convert that into httparty. 我不能完全将其转换为httparty。 I have this so far.
到目前为止,我已经知道了。
response = HTTParty.post("https://hekki.isks.com/api/userauth",
:username => "hello",
:password => "no",
:token => 132321212,
:headers => { 'Content-Type' => 'application/json' } )
I think it should be: 我认为应该是:
response = HTTParty.post("https://hekki.isks.com/api/userauth",
:body=> {
:username => "hello",
:password => "no",
:token => 132321212
} )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.