如何使用 REST API 通过指针查询对象?
How to query objects through a Pointer using REST API?
我在 parse.com 上托管了这个结构:
事件
- objectId:
String
- playerId:
Pointer<Player>
- 匹配编号:
Pointer<Match>
- 其他一些与问题无关的属性
匹配
- objectId:
String
- ownerId:
String
- 匹配日期:
Date
我想使用 REST 检索与一个特定比赛相关的所有事件,但我使用的查询有问题。
这是我正在使用的查询(ruby 与 HTTParty gem):
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"}}}'
我在 parse.com 上托管了这个结构:
事件
- objectId:
String
- playerId:
Pointer<Player>
- 匹配编号:
Pointer<Match>
- 其他一些与问题无关的属性
匹配
- objectId:
String
- ownerId:
String
- 匹配日期:
Date
我想使用 REST 检索与一个特定比赛相关的所有事件,但我使用的查询有问题。
这是我正在使用的查询(ruby 与 HTTParty gem):
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"}}}'