简体   繁体   English

剩余api计数列数据

[英]rest api count column data

Is it possible with the Parse REST API to query for column data and have it return count in for each type encountered in that column? 使用Parse REST API可以查询列数据并返回该列中遇到的每种类型的计数吗?

For instance: 例如:

column1 column2 column3 column1 column2 column3

type3 type1 type3 类型3类型1类型3

type3 type3 type1 类型3类型3类型1

type3 type1 type4 类型3类型1类型4

type3 type1 type3 类型3类型1类型3

So, I want the number of type 3's, 2's, and 1's in column3 returned like: 因此,我希望在column3中返回类型3、2和1的数量,例如:

type3 = 2 类型3 = 2

type1 = 1 类型1 = 1

type4 = 1 类型4 = 1

Yes, you can send a query via the REST-API and pass in the parameter count=1 to only return the number of possible results instead of the actual objects. 是的,您可以通过REST-API发送查询并传递参数count = 1以仅返回可能结果的数量,而不是实际对象的数量。

Here is an example I took from the documentation [1]: 这是我从文档[1]中获取的示例:

curl -X GET \
  -H "X-Parse-Application-Id: YOUR_APP_ID" \
  -H "X-Parse-REST-API-Key: YOUR_REST_API_KEY" \
  -G \
  --data-urlencode 'where={"column3":"type3"}' \
  --data-urlencode 'count=1' \
  --data-urlencode 'limit=0' \
  https://api.parse.com/1/classes/YOUR_CLASSNAME

[1] https://www.parse.com/docs/rest#queries-counting [1] https://www.parse.com/docs/rest#queries-counting

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM