shi*_*las 10 ruby httparty oauth-2.0
我可以通过以下方式从Oauth2 API获取信息:
token = "Token I get from authenticating my App"
auth = "Bearer " + token
user = HTTParty.get("API Website", :headers => { "Authorization" => auth})
Run Code Online (Sandbox Code Playgroud)
我将如何发布到我的应用中生成的API内容?我有一个实例变量:
@contact = {"contact": {"name": "John Doe" }}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
token = "Token I get from authenticating my App"
auth = "Bearer " + token
user = HTTParty.get("API Website", :headers => { "Authorization" => auth}, @contact)
Run Code Online (Sandbox Code Playgroud)
无济于事.
shi*_*las 11
回答了我自己的问题
HTTParty.post("API Website", :headers => { "Authorization" => auth}, :body => "@contact")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5187 次 |
| 最近记录: |