Skip to content

Commit

Permalink
Modify api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Cong committed Mar 8, 2018
1 parent 79ef145 commit 530fe73
Showing 13 changed files with 154 additions and 129 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -110,10 +110,10 @@
<a href="/open-api/authentication.md/">授权认证</a>
</li>
<li>
<a href="/open-api/record.md/">数据表模块</a>
<a href="/open-api/data/README.md/">数据表模块</a>
</li>
<li>
<a href="/open-api/content.md/">内容模块</a>
<a href="/open-api/content/README.md/">内容模块</a>
</li>
<li>
<a href="/open-api/file/README.md/">文件模块</a>
@@ -128,17 +128,17 @@
</li>
<li>
<h3>
<a href="/user-dash/README.md/">知晓云运营 API</a>
<a href="/user-dash/README.md/">运营后台 API</a>
</h3>
<ul class="doc-user-dash doc-detail-item">
<li>
<a href="/user-dash/authentication.md/">授权认证</a>
</li>
<li>
<a href="/user-dash/record.md/">数据表模块</a>
<a href="/user-dash/data/README.md/">数据表模块</a>
</li>
<li>
<a href="/user-dash/content.md/">内容模块</a>
<a href="/user-dash/content/README.md/">内容模块</a>
</li>
<li>
<a href="/user-dash/file/README.md/">文件模块</a>
3 changes: 2 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
@@ -71,7 +71,8 @@

----

* [知晓云运营 API](user-dash/README.md)
* [运营后台 API](user-dash/README.md)
* [授权认证](user-dash/authentication.md)
* [数据模块](user-dash/data/README.md)
* [数据表操作](user-dash/data/table.md)
* [数据操作](user-dash/data/record.md)
16 changes: 8 additions & 8 deletions open-api/content/content-category.md
Original file line number Diff line number Diff line change
@@ -50,14 +50,14 @@ https://cloud.minapp.com/oserve/v1/content/1/category/1/

**返回参数说明**

| 参数 | 说明 |
| :-------------| :------ |
| id | 分类 ID |
| name | 分类名称 |
| parent | 分类的父类 |
| subcategories | 子类名称 |
| created_at | 分类创建时间 |
| updated_at | 分类更新时间 |
| 参数 | 类型 | 说明 |
| :-------------| :----------- | :------ |
| id | Integer | 分类 ID |
| name | String | 分类名称 |
| parent | Object | 分类的父类 |
| subcategories | Object Array | 子类名称 |
| created_at | Integer | 分类创建时间 |
| updated_at | Integer | 分类更新时间 |

## 获取内容分类列表

22 changes: 11 additions & 11 deletions open-api/content/content.md
Original file line number Diff line number Diff line change
@@ -49,17 +49,17 @@ https://cloud.minapp.com/oserve/v1/content/1/text/1/

**返回参数说明**

| 参数 | 说明 |
| :---------- | :---- |
| id | 内容 ID |
| title | 内容标题 |
| content | 详细容 |
| cover | 封面图 |
| description | 内容摘要 |
| group_id | 内容库 ID |
| categories | 内容所属分类 |
| created_at | 内容创建时间 |
| updated_at | 内容更新时间 |
| 参数 | 类型 | 说明 |
| :---------- | :----------- | :---- |
| id | Integer | 内容 ID |
| title | String | 内容标题 |
| content | String | 详细容 |
| cover | String | 封面图 |
| description | String | 内容摘要 |
| group_id | Integer | 内容库 ID |
| categories | Object Array | 内容所属分类 |
| created_at | Integer | 内容创建时间 |
| updated_at | Integer | 内容更新时间 |


## 获取内容列表
2 changes: 1 addition & 1 deletion open-api/data/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- ex_nonav -->

# 数据模块
# 数据表模块

* [数据表操作](./table.md)
* [数据操作](./record.md)
7 changes: 3 additions & 4 deletions open-api/user.md
Original file line number Diff line number Diff line change
@@ -67,8 +67,7 @@ request(opt, function(err, res, body) {

`GET https://cloud.minapp.com/oserve/v1/miniapp/user-profile/`

**参数说明
**
**参数说明**

| 参数 | 类型 | 必填 | 说明 |
| :--------- | :----- | :-- | :-- |
@@ -107,7 +106,7 @@ https://cloud.minapp.com/oserve/v1/miniapp/user-profile/
var request = require('request');

var opt = {
uri: 'https://cloud.minapp.com/oserve/v1/miniapp/user-profile/',
uri: 'https://cloud.minapp.com/oserve/v1/miniapp/user-profile/',
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
@@ -126,4 +125,4 @@ request(opt, function(err, res, body) {
})
```

{% endtabs %}
{% endtabs %}
4 changes: 2 additions & 2 deletions user-dash/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- ex_nonav -->

# 知晓云运营 API
# 运营后台 API

知晓云支持开发者结合 User Dash API 按需编写一套独立的运营后台,供并非开发者的用户使用
知晓云支持开发者结合 User Dash API 按需编写一套独立的运营后台,供非开发者的用户使用

若遇到问题,请联系 <minapp-support@ifanr.com> 或者客服(微信号:minsupport)
29 changes: 29 additions & 0 deletions user-dash/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 授权认证

## 鉴权方式

用户管理后台 API 采用的 Cookie-base 的授权方式来实现用户身份的授权。

## 授权流程

开发者需要将以下代码片段放入用户管理后台的 .html 文件中,来完成用户身份的验证:

```html
<!-- 其中 client_id 需替换为您应用的 ClientID -->
<script src="https://cloud.minapp.com/custom-userdash/auth/<client_id>/"></script>
```

示例:

```html
<html>
<head>
<!-- 其中 client_id 需替换为您应用的 ClientID -->
<script src="https://cloud.minapp.com/custom-userdash/auth/<client_id>/"></script>
</head>
<body>
</body>
</html>
```

用户管理后台可能会存在多个管理页面,需要保证每个管理页面的 **head** 都加入上述代码片段,以确保页面的登录状态。
18 changes: 9 additions & 9 deletions user-dash/content/content-category.md
Original file line number Diff line number Diff line change
@@ -44,14 +44,14 @@ https://cloud.minapp.com/userve/v1/content/1/category/1/

**返回参数说明**

| 参数 | 说明 |
| :-------------| :------ |
| id | 分类 ID |
| name | 分类名称 |
| parent | 分类的父类 |
| subcategories | 子类名称 |
| created_at | 分类创建时间 |
| updated_at | 分类更新时间 |
| 参数 | 类型 | 说明 |
| :-------------| :----------- | :------ |
| id | Integer | 分类 ID |
| name | String | 分类名称 |
| parent | Object | 分类的父类 |
| subcategories | Object Array | 子类名称 |
| created_at | Integer | 分类创建时间 |
| updated_at | Integer | 分类更新时间 |

## 获取内容分类列表

@@ -136,7 +136,7 @@ https://cloud.minapp.com/userve/v1/content/1/category/

Content-Type: `application/json`

| 参数 | 类型 | 必填 | 说明 |
| 参数 | 类型 | 必填 | 说明 |
| :----- | :----- | :-- | :-- |
| name | String | Y | 分类名称 |
| parent | Integer | N | 父分类 ID |
22 changes: 11 additions & 11 deletions user-dash/content/content.md
Original file line number Diff line number Diff line change
@@ -43,17 +43,17 @@ https://cloud.minapp.com/userve/v1/content/1/text/1/

**返回参数说明**

| 参数 | 说明 |
| :---------- | :---- |
| id | 内容 ID |
| title | 内容标题 |
| content | 详细容 |
| cover | 封面图 |
| description | 内容摘要 |
| group_id | 内容库 ID |
| categories | 内容所属分类 |
| created_at | 内容创建时间 |
| updated_at | 内容更新时间 |
| 参数 | 类型 | 说明 |
| :---------- | :----------- | :---- |
| id | Integer | 内容 ID |
| title | String | 内容标题 |
| content | String | 详细容 |
| cover | String | 封面图 |
| description | String | 内容摘要 |
| group_id | Integer | 内容库 ID |
| categories | Object Array | 内容所属分类 |
| created_at | Integer | 内容创建时间 |
| updated_at | Integer | 内容更新时间 |


## 获取内容列表
2 changes: 1 addition & 1 deletion user-dash/data/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- ex_nonav -->

# 数据模块
# 数据表模块

* [数据表操作](./table.md)
* [数据操作](./record.md)
36 changes: 1 addition & 35 deletions user-dash/data/record.md
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ curl -X GET \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-G \
--data-urlencode 'where={"price":"$eq":10}' \
--data-urlencode 'where={"price": {"$eq": 10}}' \
https://cloud.minapp.com/userve/v1/table/1/record/
```

@@ -92,40 +92,6 @@ https://cloud.minapp.com/userve/v1/table/:table_id/record/?order_by=id
https://cloud.minapp.com/userve/v1/table/:table_id/record/?order_by=-id
```

**代码示例**

```python
import json
import urllib

import requests


table_id = ''
BASE_API = r'https://cloud.minapp.com/userve/v1/table/%s/record/' % table_id

TOKEN = ''
HEADERS = {
'cookie': '{{ cookie }}'
}

where_ = {
'price': {'$gt': 100},
}

query_ = urllib.urlencode({
'where': json.dumps(where_),
'order_by': '-id',
'limit': 10,
'offset': 0,
})

API = '?'.join((BASE_API, query_))

resp_ = requests.get(API, headers=HEADERS)
print resp_.content
```

## 获取数据项

**接口**
Loading

0 comments on commit 530fe73

Please sign in to comment.