PHP-解析-错误”:";必须至少指定一个ID字段(installationId、deviceToken)


PHP - Parse - error":"at least one ID field (installationId,deviceToken) must be specified

我正试图获得一个基于userID字段的安装列表。目前,这会返回错误"必须在此操作中指定至少一个ID字段(installationId,deviceToken)"

$url = 'https://api.parse.com/1/installations';
$user_id = "3014";
$APPLICATION_ID = 'xxxxxxxxxxxxxxxx';
$REST_API_KEY = 'xxxxxxxxxxxxxxxx';
$MASTER_KEY = 'xxxxxxxxxxxxxxxx';
$data = array
    (
        "where" => array(
            "userID" => $user_id,
        ),
    );
$_data = json_encode($data);
$headers = array(
    'Content-Type: application/json',
    'X-Parse-Application-Id: ' . $APPLICATION_ID,
    'X-Parse-REST-API-Key: ' . $REST_API_KEY,
    'X-Parse-Master-Key: ' . $MASTER_KEY,
    'Content-Length: ' . strlen($_data),
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $_data);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );
$response = curl_exec($curl);
var_dump($response);
curl_close($ch);

有人知道我哪里错了吗?

感谢

您正在执行POST请求,而您应该执行GET请求,请参阅https://www.parse.com/docs/rest/guide#queries-查询约束

您将想要命名$vars,并且只将'column'更改为您试图提取的列名。请注意,它的拼写/大写字符也必须相同。

  <html>
    <head>
    <style>
    td {
        text-align:center;
        border: 1px solid black;
    }
    </style>
    </head>
    <body>
    <?php
    include_once 'DB.Connect.php';
    // error_reporting(E_ALL); 

        $url="http://url.com"
        $ch = curl_init();
            curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);       
        $json = curl_exec($ch);
            curl_close($ch);        
    $DataA = json_decode($json, TRUE);  
    $c = 0;
    echo '<center><table>';
    echo '<tr><th>Title</th></tr>';
    foreach ($DataA as $data) { 
        $var        = $DataA[$c]['column'];         
        echo '<tr>';
        echo '<td>'.$DataA[$c]['column'].'</td>';
        echo '<td>None</td>';
        echo '<td></td>';       
        echo '</tr>';
            }

        $c++;
        ?>
        </body>
        </html>