Parse.comにログインせずにオブジェクトIDを介してユーザーテーブルを更新する(REST APIを使用)

StackOverflow https://stackoverflow.com//questions/25011042

  •  20-12-2019
  •  | 
  •  

質問

次のコードを使用して、ObjectIDを使用して(ユーザーがログインするとともに)Data Browserのユーザーテーブルを更新します。

しかし私はget:

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

これが何が悪いのか教えてもらえますか:

$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;
.

役に立ちましたか?

解決

私の自己の問題を解決しました、URL私は使用していたURLがデータを保存することです

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

私はデータを更新するためにURLを変更したばかりで問題が解決された

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

編集のための幽霊host

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top