解析 - 获取安装数量

时间:2014-09-13 18:16:50

标签: python api rest installation parse-platform

在安装集合上执行查找操作时,有没有办法强制使用主密钥?

这就是我正在做的事情。我试图获得安装总数。

connection = httplib.HTTPSConnection('api.parse.com', 443)

params = urllib.urlencode({"count": 1, "limit": 0 })

connection.connect()
connection.request('GET', '/1/installations?%s' % params, '', {
       "X-Parse-Application-Id": "app id",
       "X-Parse-REST-API-Key": "rest api key"
})

result = json.loads(connection.getresponse().read())

这是我得到的json回应。

{
    code: 119,
    error: "Clients aren't allowed to perform the find operation on the installation collection."
}

1 个答案:

答案 0 :(得分:0)

将您的主密钥添加到您的connection.request:

connection.request('GET', '/1/installations?%s' % params, '', {
       "X-Parse-Application-Id": "app id",
       "X-Parse-REST-API-Key": "rest api key", 
       "X-Parse-Master-Key": "the master key"
})