1.1 Subscription API 概述
1.2.Subscription API 新增单个数据
POST /portal/api/v2/subscription/{bundle} HTTP/1.1
Host: etl.dd:8083
Content-Type: application/vnd.api+json
Authorization: Bearer 50c8f237ecc91ac3f151e9d3cc615726
Accept: application/vnd.api+json
{
"data": {
"type": "subscription--{bundle}",
"attributes": {
"title": "新闻公告订阅",
"target_id": "88981",
"action":"collection",
"status":1,
"uuid":"18926ba9-4a93-429d-ae63-27836af5d369"
},
"relationships": {
"target_type": {
"data": { "type": "taxonomy_term--subscription_target_type", "id": "18926ba9-4a93-429d-ae63-27836af5d366" }
}
}
}
}
1.2.1.Subscription API 新增单个数据的请求参数
具体的字段如下: |
参数名 |
类型 |
是否必需 |
描述 |
type |
string |
是 |
bundle可设置subscription |
|
title |
string |
否 |
标题 |
|
target_type |
int |
是 |
订阅类型分类 |
|
action |
string |
是 |
默认值like,collection, follow, comment,post, update,subscribe |
|
target_id |
string |
是 |
订阅栏目id |
|
1.3 更新单个数据
PATCH /portal/api/v2/subscription/{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": "subscription--{bundle}",
"id": "{uuid}"
"attributes": {
"title": "新闻公告订阅",
"target_id": "88981",
"action":"collection",
"status":1
},
"relationships": {
"target_type": {
"data": { "type": "taxonomy_term--subscription_target_type", "id": "18926ba9-4a93-429d-ae63-27836af5d366" }
}
}
}
}
1.3.1.Subscription API 更新单个数据的请求参数
具体的字段如下: |
参数名 |
类型 |
是否必需 |
描述 |
type |
string |
是 |
bundle可设置subscription |
|
title |
string |
否 |
标题 |
|
target_type |
int |
是 |
订阅类型分类 |
|
action |
string |
是 |
默认值like,collection, follow, comment,post, update,subscribe |
|
target_id |
string |
是 |
订阅栏目id |
|
1.4. 删除单个数据
DELETE /portal/api/v2/subscription/{bundle}/{8beb578b-7557-4656-90e8-0f12395e35a2} HTTP/1.1
Host: etl.dd:8083
Accept: application/vnd.api+json
Authorization: Bearer 49353835a83f30b26f81dc2351330a4b
1.5. 查询单个数据
GET /portal/api/v2/subscription/{bundle}/{d1f94da3-990d-4d70-9441-a30bbed4d91e} HTTP/1.1
Host: etl.dd:8083
Authorization: Bearer 49353835a83f30b26f81dc2351330a4b
Accept: application/vnd.api+json
1.6.查询当前用户自己创建的所有数据
GET /portal/api/v2/subscription/me?_format=hal_json HTTP/1.1
Host: portal.xx.edu.com.cn
Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j
action={like}&type={subscription}&target_type={7}&page={}&items_per_page={}
1.7.查询系统默认订阅列表
GET /portal/api/v2/subscription/default?_format=hal_json HTTP/1.1
Host: portal.xx.edu.com.cn
Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j
action={like}&type={subscription}&target_type={7}&page={}&items_per_page={}
1.8.查询数据的请求参数说明
具体的字段如下: |
参数名 |
类型 |
是否必需 |
描述 |
type |
string |
是 |
bundle可设置subscription |
|
title |
string |
否 |
标题 |
|
target_type |
int |
是 |
订阅类型分类 |
|
action |
string |
是 |
默认值like,collection, follow, comment,post, update,subscribe |
|
target_id |
string |
是 |
订阅栏目id |
|
1.9. 查询数据的响应信息
[
{
"id":"5",
"uuid":"39aec9c68b679d43de6803e0f14c223j",
"target_id":"testt",
"title":"新闻动态",
"target_type":"7",
"action":"follow",
"type":"subscription",
"created":"2020-05-14T10:20:14+0800"
},
{
"id":"4",
"uuid":"39aec9c68b679d43de6803e0f14c223f",
"target_id":"changed0000",
"title":"通知公告",
"target_type":"2",
"action":"like",
"type":"subscription",
"created":"2020-05-12T15:36:42+0800"
},
{
"id":"2",
"uuid":"39aec9c68b679d43de6803e0f14c223w",
"target_id":"changed0000",
"title":"会议通知",
"target_type":"1",
"action":"follow",
"type":"subscription",
"created":"2020-05-12T15:08:21+0800"
"enable":1
}
]
1.9.1.响应信息字段说明
具体的字段如下: |
参数名 |
类型 |
描述 |
type |
string |
订阅类型,用户订阅列表和系统默认订阅列表(system_subscription_list) |
|
title |
string |
标题 |
|
target_type |
int |
订阅类型分类 |
|
action |
string |
默认值like,collection, follow, comment,post, update,subscribe |
|
target_id |
string |
订阅栏目id |
|
created |
date |
创建时间 |
|
enable |
int |
是否默认开启,1为开启,当查询系统默认订阅列表时可用。 |
|
1.10.错误码
融合门户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 |