Skip to content

Commit

Permalink
Support built-in table custom fields to obtain.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Cong committed Mar 6, 2018
1 parent d017d30 commit 85fa62e
Show file tree
Hide file tree
Showing 27 changed files with 4,195 additions and 6 deletions.
31 changes: 29 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@

* [知晓云开放 API](open-api/README.md)
* [授权认证](open-api/authentication.md)
* [数据表模块](open-api/record.md)
* [内容模块](open-api/content.md)
* [数据模块](open-api/data/README.md)
* [数据表操作](open-api/data/table.md)
* [数据操作](open-api/data/record.md)
* [内容模块](open-api/content/README.md)
* [内容库操作](open-api/content/content-group.md)
* [内容分类操作](open-api/content/content-category.md)
* [内容操作](open-api/content/content.md)
* [内容操作(不建议使用)](open-api/content-abandoned.md)
* [文件模块](open-api/file/README.md)
* [文件上传](open-api/file/file-upload.md)
* [文件操作](open-api/file/file.md)
Expand All @@ -65,6 +71,27 @@

----

* [知晓云运营 API](user-dash/README.md)
* [授权认证](user-dash/authentication.md)
* [数据模块](user-dash/data/README.md)
* [数据表操作](user-dash/data/table.md)
* [数据操作](user-dash/data/record.md)
* [内容模块](user-dash/content/README.md)
* [内容库操作](user-dash/content/content-group.md)
* [内容分类操作](user-dash/content/content-category.md)
* [内容操作](user-dash/content/content.md)
* [文件模块](user-dash/file/README.md)
* [文件上传](user-dash/file/file-upload.md)
* [文件操作](user-dash/file/file.md)
* [文件分类操作](user-dash/file/file-category.md)
* [分组模块](user-dash/group/README.md)
* [用户组操作](user-dash/group/user-group.md)
* [用户组与用户的操作](user-dash/group/membership.md)
* [组集操作](user-dash/group/super-group.md)
* [用户模块](user-dash/user.md)

----

* [管理与支持](support/README.md)
* [常见问题](support/qA.md)
* [服务协议](support/terms.md)
Expand Down
9 changes: 9 additions & 0 deletions open-api/content/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- ex_nonav -->

# 内容模块

支持了内容库、内容分类和内容的创建、编辑和删除等操作,同时内容接口支持自定义字段数据的获取与修改。

* [内容库操作](./content-group.md)
* [内容分类操作](./content-category.md)
* [内容操作](./content.md)
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 内容操作

> **danger**
> 以下操作不支持内容表自定义字段的获取,建议使用[内容操作](./content.md)接口。
## 内容库

### 获取内容库详情
Expand Down Expand Up @@ -418,4 +421,4 @@ request(opt, function(err, res, body) {
}
]
}
```
```
271 changes: 271 additions & 0 deletions open-api/content/content-category.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
# 内容分类操作

## 获取内容分类详情

**接口**

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

其中 `content_group_id` 是内容库的 ID, `category_id` 是内容分类的 ID

**代码示例**

{% tabs getContentCategoryCurl="Curl"%}

{% content "getContentCategoryCurl" %}

```
curl -X GET \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/1/category/1/
```

{% endtabs %}

**返回示例**

```json
{
"id": 1,
"name": "category",
"parent": null,
"subcategories": [
{
"id": 2,
"name": "subcategory",
"parent": {
"id": 1,
"name": "category"
},
"subcategories": [],
"created_at": 1519901783,
"updated_at": 1519901783
}
],
"created_at": 1516963449,
"updated_at": 1516963449
}
```

**返回参数说明**

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

## 获取内容分类列表

**接口**

`GET https://cloud.minapp.com/oserve/v1/content/1/category/1/`

**提交参数**

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

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

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

`https://cloud.minapp.com/oserve/v1/content/:content_id/category/?name=category`


**代码示例**

{% tabs getContentCategoryListCurl="Curl"%}

{% content "getContentCategoryListCurl" %}

```
curl -X GET \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/1/category/
```

{% endtabs %}

**返回示例**

```json
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 2
},
"objects": [
{
"id": 1,
"name": "category",
"parent": null,
"subcategories": [
{
"id": 2,
"name": "subcategory",
"parent": {
"id": 1,
"name": "category"
},
"subcategories": [],
"created_at": 1519901783,
"updated_at": 1519901783
}
],
"created_at": 1516963449,
"updated_at": 1516963449
},
{
"id": 2,
"name": "subcategory",
"parent": {
"id": 1516963449144537,
"name": "category"
},
"subcategories": [],
"created_at": 1519901783,
"updated_at": 1519901783
}
]
}
```

## 创建内容分类

**接口**

`POST https://cloud.minapp.com/oserve/v1/content/`

**参数说明**

Content-Type: `application/json`

| 参数 | 类型 | 必填 | 说明 |
| :--- | :----- | :-- | :-- |
| name | String | Y | 分类名称 |
| parent | Number | N | 父分类 ID |

> **warning**
> 注意:最多只允许三层嵌套分类
**代码示例**

{% tabs createContentCategoryCurl="Curl"%}

{% content "createContentCategoryCurl" %}

```
curl -X POST \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
-d '{
"name": "分类1",
}' \
https://cloud.minapp.com/oserve/v1/content/1/category/
```

{% endtabs %}

**返回示例**

```json
{
"id": 3,
"name": "分类1",
"parent": null,
"subcategories": [],
"created_at": 1519910966,
"updated_at": 1519910966
}
```

**状态码说明**

`201`: 创建成功

`400`: 同一父分类下的子分类名不能相同

`404`: 父分类 ID 不合法


## 编辑内容分类

**接口**

`PUT https://cloud.minapp.com/oserve/v1/content/:content_group_id/catgegory/:category_id/`


**代码示例**

{% tabs updateContentCategoryCurl="Curl"%}

{% content "updateContentCategoryCurl" %}

```
curl -X PUT \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
-d '{
"name": "Test Category"
}' \
https://cloud.minapp.com/oserve/v1/content/1/category/3/
```

{% endtabs %}

**返回示例**

```json
{
"id": 3,
"name": "Test Category",
"parent": null,
"subcategories": [],
"created_at": 1519910966,
"updated_at": 1519910966
}
```

**状态码说明**

`200`: 修改成功

`400`: 同一父分类下的子分类名不能相同

`404`: 父分类 ID 不合法


## 删除内容库

**接口**

`DELETE https://cloud.minapp.com/oserve/v1/content/:content_group_id/category/:category_id/`


**代码示例**

{% tabs deleteContentCategoryCurl="Curl"%}

{% content "deleteContentCategoryCurl" %}

```
curl -X DELETE \
-H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/content/1/category/1/
```

{% endtabs %}


**状态码说明**

`204`: 删除成功
Loading

0 comments on commit 85fa62e

Please sign in to comment.