我在 parse.com 上托管了这个结构:
事件
- 对象ID:
String
- 玩家ID:
Pointer<Player>
- 比赛 ID:
Pointer<Match>
- 一些与问题无关的其他属性
匹配
- 对象ID:
String
- 所有者 ID:
String
- 比赛日期:
Date
我想使用 REST 检索与一场特定比赛相关的所有事件,但我使用的查询有问题。
这是我正在使用的查询(带有 HTTParty gem 的 ruby):
base_uri = "https://api.parse.com/1/classes"
endpoint = 'Event/?&include=matchId&where={"ownerId":"201"}'
app_id = "app_id"
rest_api_key = "api_key"
headers = {"X-Parse-Application-Id" => app_id,
"X-Parse-REST-API-Key" => rest_api_key,
"Content-Type" => "application/json"}
response = HTTParty.get(URI.encode("#{base_uri}/#{endpoint}"), headers: headers)
最佳答案
事实证明,它的做法与 relational queries 相同。 。这是工作查询:
endpoint = 'Event/?where={"matchId":{"$inQuery":{"where":{"ownerId":201},"className":"Match"}}}'
关于rest - 如何使用 REST API 通过指针查询对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28013092/