|
|
|
|
|
|
|
## 1.1 Taxonomy API 概述
|
|
|
|
- Taxonomy API 是所有Taxonomy接口的统称
|
|
|
|
- Taxonomy API 有多种新增、更新、删除接口,具体的接口如下:
|
|
|
|
- 增加单个taxonomy
|
|
|
|
- 删除、查询、删除单个taxonomy
|
|
|
|
- 根据词汇表查询所有的分类信息
|
|
|
|
- 新增taxonomy接口:[/portal/api/v2/taxonomy/term/{vid}](https://note.youdao.com/): POST
|
|
|
|
- 删除、更新、查询单个taxonomy接口:[/portal/api/v2/taxonomy/term/{vid}/{uuid}](https://note.youdao.com/): GET, PATCH, DELETE
|
|
|
|
- 根据词汇表查询所有的分类信息: [https://{site}/portal/api/v2/taxonomy?_format=json](https://note.youdao.com/) GET
|
|
|
|
- 如需要额外接口满足项目需求,可以通过后台使用**Portal Views**配置
|
|
|
|
## 1.2.Taxonomy API 新增单个数据
|
|
|
|
```
|
|
|
|
POST /portal/api/v2/taxonomy_term/{vid} HTTP/1.1
|
|
|
|
Host: etl.dd:8083
|
|
|
|
Content-Type: application/vnd.api+json
|
|
|
|
Authorization: Bearer 50c8f237ecc91ac3f151e9d3cc615726
|
|
|
|
Accept: application/vnd.api+json
|
|
|
|
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"type": "taxonomy_term--{vid}",
|
|
|
|
"attributes": {
|
|
|
|
"name": "科研系统"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
## 1.2.1.Taxonomy API 新增单个数据的请求参数
|
|
|
|
具体的字段如下:
|
|
|
|
参数名 | 类型 | 是否必需 | 描述
|
|
|
|
---|---|--|----|---
|
|
|
|
vid | string | 是 | bundle系统定义的各类分类key
|
|
|
|
name | string | 是 | 名称
|
|
|
|
|
|
|
|
## 1.3 更新单个数据
|
|
|
|
|
|
|
|
```
|
|
|
|
PATCH /portal/api/v2/taxonomy_term/{bundle}/{uuid} HTTP/1.1
|
|
|
|
Host: etl.dd:8083
|
|
|
|
Content-Type: application/vnd.api+json
|
|
|
|
Authorization: Bearer 50c8f237ecc91ac3f151e9d3cc615726
|
|
|
|
Accept: application/vnd.api+json
|
|
|
|
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"type": "taxonomy_term--{bundle}",
|
|
|
|
"id":"{uuid}",
|
|
|
|
"attributes": {
|
|
|
|
"name": "科研系统updated"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 1.3.1.Taxonomy API 更新单个数据的请求参数
|
|
|
|
具体的字段如下:
|
|
|
|
参数名 | 类型 | 是否必需 | 描述
|
|
|
|
---|---|--|----|---
|
|
|
|
_links | string | 是 | 参数bundle为具体内容类型的key,{bundle}系统有tags,department等
|
|
|
|
type | string | 是 | 参数bundle为具体内容类型的key,{bundle}系统有tags,department等
|
|
|
|
vid | string | 是 | bundle系统定义的各类分类key
|
|
|
|
name | string | 是 | 名称
|
|
|
|
|
|
|
|
## 1.4.删除单个数据
|
|
|
|
```
|
|
|
|
DELETE /portal/api/v2/taxonomy_term/{bundle}/{uuid} HTTP/1.1
|
|
|
|
Host: etl.dd:8083
|
|
|
|
Authorization: Bearer 50c8f237ecc91ac3f151e9d3cc615726
|
|
|
|
Accept: application/vnd.api+json
|
|
|
|
```
|
|
|
|
## 1.5.查询单个数据
|
|
|
|
```
|
|
|
|
GET /portal/api/v2/taxonomy_term/{bundle}/{uuid} HTTP/1.1
|
|
|
|
Host: portal.xx.edu.com.cn
|
|
|
|
Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j
|
|
|
|
```
|
|
|
|
## 1.6.根据词汇表id查询所有数据
|
|
|
|
```
|
|
|
|
GET /portal/api/v2/taxonomy/term?_format=json HTTP/1.1
|
|
|
|
Host: portal.xx.edu.com.cn
|
|
|
|
Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j
|
|
|
|
|
|
|
|
vid={tag}&name={value}&parent_id={parent_id}&tid={tid}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 1.7.查询数据的请求参数说明
|
|
|
|
具体的字段如下:
|
|
|
|
参数名 | 类型 | 是否必需 | 描述
|
|
|
|
---|---|--|----|---
|
|
|
|
vid | string | 否 | 词汇表id
|
|
|
|
name | string | 否 | 根据关键字来搜索相关分类信息
|
|
|
|
parent_id | int | 否 | 父类id
|
|
|
|
tid | string | 否 | 分类id
|
|
|
|
|
|
|
|
## 1.8. 查询数据的响应信息
|
|
|
|
|
|
|
|
```
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"uuid": "528ed54e-557a-4174-bb03-91c61b73dc47",
|
|
|
|
"tid": "4",
|
|
|
|
"name": "办公应用",
|
|
|
|
"parent": "",
|
|
|
|
"vid": "app_category",
|
|
|
|
"weight": "0",
|
|
|
|
"description": "",
|
|
|
|
"status": "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"uuid": "eece47b9-05b2-41f3-b0c7-d849851fdf9d",
|
|
|
|
"tid": "5",
|
|
|
|
"name": "基础服务",
|
|
|
|
"parent": "",
|
|
|
|
"vid": "app_category",
|
|
|
|
"weight": "0",
|
|
|
|
"description": "",
|
|
|
|
"status": "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"uuid": "2d062779-4d71-47e1-8519-e8350659158c",
|
|
|
|
"tid": "1",
|
|
|
|
"name": "校办公",
|
|
|
|
"parent": "",
|
|
|
|
"vid": "department",
|
|
|
|
"weight": "0",
|
|
|
|
"description": "",
|
|
|
|
"status": "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"uuid": "d605af12-1af7-4933-91a1-19efe1088931",
|
|
|
|
"tid": "2",
|
|
|
|
"name": "学生处",
|
|
|
|
"parent": "",
|
|
|
|
"vid": "department",
|
|
|
|
"weight": "0",
|
|
|
|
"description": "",
|
|
|
|
"status": "1"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
## 1.8.1.响应信息字段说明
|
|
|
|
具体的字段如下:
|
|
|
|
参数名 | 类型 | 描述
|
|
|
|
---|---|--|----
|
|
|
|
name | string | 分类名称
|
|
|
|
weight | init | 排序
|
|
|
|
tid | int | 分类id
|
|
|
|
vid | int | 词汇表id
|
|
|
|
parent | int | 父类id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 1.9.错误码
|
|
|
|
融合门户REST API接口较多,开发者使用过程中不可避难会遇到各种问题,这里提供了常见的错误码释义。
|
|
|
|
|
|
|
|
错误码 | 含义
|
|
|
|
---|---
|
|
|
|
200 | OK
|
|
|
|
201 | Created
|
|
|
|
202 | Accepted
|
|
|
|
204 | No Content
|
|
|
|
301 |Moved Permanently
|
|
|
|
302 |Found
|
|
|
|
400| Bad Request
|
|
|
|
401| Unauthorized
|
|
|
|
403 |Forbidden
|
|
|
|
404 |Not Found
|
|
|
|
405 |Method Not Allowed
|
|
|
|
406 |Not Acceptable
|
|
|
|
415 |Unsupported Media Type
|
|
|
|
500 |Internal Server Error
|
|
|
|
501 |Not Implemented
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|