简体   繁体   English

通过对象ID更新用户表,而无需在parse.com中登录(使用REST API)

[英]update users table through object id without login in parse.com(USING REST API)

I want to update User table of DATA BROWSER using objectId(With out getting user to log in ) using following code. 我想使用以下代码使用objectId(无需让用户登录)更新DATA BROWSER的User表。

But I am getting: 但我得到:

error({"code":101,"error":"object not found for update"}) 

can any one tell me what is wrong with this: 谁能告诉我这是怎么回事:

$className = "Classname";

$objectIdToEdit = $_SESSION['objectId'];

$url = 'https://api.parse.com/1/classes/' . $className . '/' . $objectIdToEdit;

$appId = '***********************';
$restKey = '***********';
$updatedData = '{"firstname":"Billie123"}';

$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_PORT,443);
curl_setopt($rest,CURLOPT_CUSTOMREQUEST,"PUT");
curl_setopt($rest,CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest,CURLOPT_POSTFIELDS,$updatedData);
curl_setopt($rest,CURLOPT_HTTPHEADER, array(
    "X-Parse-Application-Id: " . $appId,
    "X-Parse-Master-Key: " . $restKey,
    "Content-Type: application/json")
);

$response = curl_exec($rest);
echo $response;

I solved problem my self ,URL I was using is to save data 我解决了自己的问题,我使用的URL是保存数据

 $url = 'https://api.parse.com/1/classes/' . $className . '/' . $objectIdToEdit;

I just changed URL to update data and problem is solved 我刚刚更改了URL以更新数据,问题就解决了

$url = 'https://api.parse.com/1/' . $className . '/' . $objectIdToEdit;

thanks Ghost for editing 感谢Ghost的编辑

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

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