简体   繁体   English

如何使用Curl REST API更新Parse.com上的当前行?

[英]How to update a current row on Parse.com using a Curl REST API?

I am new to executing curl statements to update my database on Parse.com. 我不熟悉执行curl语句来更新Parse.com上的数据库。 I am able to add new rows to my class without a problem by using POST. 我可以通过使用POST将新行添加到类中而不会出现问题。 Now... I am wondering how to update a current row in my Parse database by fetching the objectId and then updating my Parse database. 现在...我想知道如何通过获取objectId然后更新我的Parse数据库来更新我的Parse数据库中的当前行。 *I want to make sure that I am querying by the correct id and then update the status. *我想确保我要查询正确的ID,然后更新状态。


I am on the right track. 我走在正确的轨道上。

curl -X GET \
  -H "X-Parse-Application-Id: my_id" \
  -H "X-Parse-REST-API-Key: my_key" \
  -G \
  --data-urlencode 'keys=SiteID,site_status' \
  https://api.parse.com/1/classes/MyClassName

How do I turn this GET method containing the objectId and put it into Parse by using it at the end of the PUT method? 如何打开包含objectId的GET方法,并在PUT方法末尾使用它来将其放入Parse?

output from curl: {"SiteID":"MOCMBS0006","site_status":"Online","createdAt":"2014-06-05T19:58:26.843Z","updatedAt":"2014-06-18T22:34:39.779Z","objectId":"randomobjectid"} curl的输出:{“ SiteID”:“ MOCMBS0006”,“ site_status”:“在线”,“ createdAt”:“ 2014-06-05T19:58:26.843Z”,“ updatedAt”:“ 2014-06-18T22:34 :39.779Z”, “对象ID”: “randomobjectid”}

Can anyone please help me? 谁能帮帮我吗? Thank you in advance!!! 先感谢您!!! Any advice would be appreciated. 任何意见,将不胜感激。 :) :)

It's in the docs here: https://parse.com/docs/rest#objects-updating 在此处的文档中: https : //parse.com/docs/rest#objects-updating

curl -X PUT \
  -H "X-Parse-Application-Id: app-id-here" \
  -H "X-Parse-REST-API-Key: rest-api-key" \
  -H "Content-Type: application/json" \
  -d '{"score":73453}' \
  https://api.parse.com/1/classes/GameScore/Ed1nuqPvcm

Note the PUT method at the top, and the objectId at the end of the URL. 请注意,PUT方法位于顶部,而objectId位于URL的末尾。 You pass in only the fields you wish to modify. 您仅输入要修改的字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM