Skip to content

Commit

Permalink
openapi/userdash/webapi mongo related api total_count return modify
Browse files Browse the repository at this point in the history
  • Loading branch information
huanlinchen committed Oct 25, 2019
1 parent ec5827e commit 0e32418
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 113 deletions.
27 changes: 21 additions & 6 deletions open-api/content/content-category.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,33 @@ curl_close($ch);

**接口**

`GET https://cloud.minapp.com/oserve/v1/content/:content_group_id/category/`
`GET https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/category/`

> **info**
> 该接口支持通过参数 return_total_count 指定是否返回查询对象总数,以协助不关心对象总数只关心查询结果列表的开发者提升接口响应速度。
同时,从 v2.2 版本开始该接口默认不返回查询对象总数,欲获取总数的开发者需要显式指定 return_total_count 参数。

**提交参数**

- parent 内容分类父分类列表查询

`https://cloud.minapp.com/oserve/v1/content/:content_group_id/category/?parent__isnull=true`
`https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/category/?parent__isnull=true`

- name 内容分类名称的等值查询

`https://cloud.minapp.com/oserve/v1/content/:content_group_id/category/?name=category`
`https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/category/?name=category`

- return_total_count 指定是否在 meta 中返回 total_count

`https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/category/?return_total_count=0`

若开发者只需要获取对象总数,则可以通过设置 `limit=1` 以及 `return_total_count=1` 来达到该效果,total_count 可从返回的 meta 中获取

请求示例:

```
https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/category/?limit=1&return_total_count=1
```

**代码示例**

Expand All @@ -129,7 +144,7 @@ curl_close($ch);
curl -X GET \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/1/category/
https://cloud.minapp.com/oserve/v2.2/content/1/category/
```

{% content "getContentCategoryListNode" %}
Expand All @@ -138,7 +153,7 @@ https://cloud.minapp.com/oserve/v1/content/1/category/
var request = require("request");

var options = { method: 'GET',
url: 'https://cloud.minapp.com/oserve/v1/content/1/category/',
url: 'https://cloud.minapp.com/oserve/v2.2/content/1/category/',
headers:
{ 'Content-Type': 'application/json',
Authorization: 'Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4' } };
Expand All @@ -155,7 +170,7 @@ request(options, function (error, response, body) {
```php
<?php
$content_group_id = 1;// 内容库的 ID
$url = "https://cloud.minapp.com/oserve/v1/content/{$content_group_id}/category/";
$url = "https://cloud.minapp.com/oserve/v2.2/content/{$content_group_id}/category/";

$ch = curl_init();
$header = array(
Expand Down
26 changes: 21 additions & 5 deletions open-api/content/content-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,33 @@ curl_close($ch);

**接口**

`GET https://cloud.minapp.com/oserve/v1/content/`
`GET https://cloud.minapp.com/oserve/v2.2/content/`

> **info**
> 该接口支持通过参数 return_total_count 指定是否返回查询对象总数,以协助不关心对象总数只关心查询结果列表的开发者提升接口响应速度。
同时,从 v2.2 版本开始该接口默认不返回查询对象总数,欲获取总数的开发者需要显式指定 return_total_count 参数。

**提交参数**

- name 内容库名称等值查询查询

例:查询内容库名称为 "内容库1" 的内容库

`https://cloud.minapp.com/oserve/v1/content/?name=内容库1`
`https://cloud.minapp.com/oserve/v2.2/content/?name=内容库1`

- return_total_count 指定是否在 meta 中返回 total_count

例:指定返回 total_count

`https://cloud.minapp.com/oserve/v2.2/content/?return_total_count=1`

若开发者只需要获取对象总数,则可以通过设置 `limit=1` 以及 `return_total_count=1` 来达到该效果,total_count 可从返回的 meta 中获取

请求示例:

```
https://cloud.minapp.com/oserve/v2.2/content/?limit=1&return_total_count=1
```

**代码示例**

Expand All @@ -103,7 +119,7 @@ curl_close($ch);
curl -X GET \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/
https://cloud.minapp.com/oserve/v2.2/content/
```

{% content "getContentGroupListNode" %}
Expand All @@ -112,7 +128,7 @@ https://cloud.minapp.com/oserve/v1/content/
var request = require("request");

var options = { method: 'GET',
url: 'https://cloud.minapp.com/oserve/v1/content/',
url: 'https://cloud.minapp.com/oserve/v2.2/content/',
headers:
{ 'Content-Type': 'application/json',
Authorization: 'Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4' } };
Expand All @@ -128,7 +144,7 @@ request(options, function (error, response, body) {

```php
<?php
$url = "https://cloud.minapp.com/oserve/v1/content/";
$url = "https://cloud.minapp.com/oserve/v2.2/content/";

$ch = curl_init();
$header = array(
Expand Down
20 changes: 16 additions & 4 deletions open-api/content/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,24 @@ curl_close($ch);

**接口**

`GET https://cloud.minapp.com/oserve/v1/content/:content_group_id/text/`
`GET https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/text/`

> **info**
> 该接口支持通过参数 return_total_count 指定是否返回查询对象总数,以协助不关心对象总数只关心查询结果列表的开发者提升接口响应速度。
同时,从 v2.2 版本开始该接口默认不返回查询对象总数,欲获取总数的开发者需要显式指定 return_total_count 参数。

**提交参数**

内容查询与[数据表接口](../data/record.md)查询保持一致

若开发者只需要获取对象总数,则可以通过设置 `limit=1` 以及 `return_total_count=1` 来达到该效果,total_count 可从返回的 meta 中获取

请求示例:

```
https://cloud.minapp.com/oserve/v2.2/content/:content_group_id/text/?limit=1&return_total_count=1
```

**代码示例**

{% tabs getRichTextEntryListCurlCurl="Curl", getRichTextEntryListCurlNode="Node", getRichTextEntryListPHP="PHP" %}
Expand All @@ -126,7 +138,7 @@ curl_close($ch);
curl -X GET \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/1/text/
https://cloud.minapp.com/oserve/v2.2/content/1/text/
```

{% content "getRichTextEntryListCurlNode" %}
Expand All @@ -135,7 +147,7 @@ https://cloud.minapp.com/oserve/v1/content/1/text/
var request = require("request");

var options = { method: 'GET',
url: 'https://cloud.minapp.com/oserve/v1/content/1/text/',
url: 'https://cloud.minapp.com/oserve/v2.2/content/1/text/',
headers:
{ 'Content-Type': 'application/json',
Authorization: 'Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4' } };
Expand All @@ -152,7 +164,7 @@ request(options, function (error, response, body) {
```php
<?php
$content_group_id = 1; // 内容库 ID
$url = "https://cloud.minapp.com/oserve/v1/content/{$content_group_id}/text/";
$url = "https://cloud.minapp.com/oserve/v2.2/content/{$content_group_id}/text/";

$ch = curl_init();
$header = array(
Expand Down
Loading

0 comments on commit 0e32418

Please sign in to comment.