更新列Parse Rest API [英] updating a column Parse Rest API
本文介绍了更新列Parse Rest API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更新ex的用户信息。电话,电子邮件等。
i am trying to update a Users information for ex. Phone, email etc.
我看过这个: https://parse.com/docs/rest/guide#users-updating-users
所以我在我的控制器:
@response = HTTParty.put('https://api.parse.com/1/users/',
:headers => {"X-Parse-Application-Id" => "APIKEY",
"X-Parse-REST-API-Key" => "APIKEY",
"X-Parse-Session-Token" => session[:session_token],
"Content-Type" => "application/json"},
:data => {"phoneNumber" => "9994432"})
我返回 @response
在一个视图中,并回到这:
{error=>请求的资源未找到}
I return @response
in a view and get back this:
{"error"=>"requested resource was not found"}
我在想可能是因为我没有传递用户的objectid在url?
I was thinking maybe its because im not passing the user's objectid in the url?
推荐答案
p>我的解决方案是强制变量为int和string
My solution is force the variables to int and string
response = HTTParty.put("https://api.parse.com/1/users/#{object_id}",
:headers => {
"X-Parse-Application-Id" => ENV['PARSE_APP_ID'].to_s,
"X-Parse-REST-API-Key" => ENV['PARSE_API_KEY'].to_s,
"X-Parse-Session-Token" => token.to_s,
"Content-Type" => "application/json"},
:body => {"h_optimum" => optimum.to_i,
"h_moderate" => moderate.to_i,
"h_appalling" => appalling.to_i}
)
这篇关于更新列Parse Rest API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文