2019-10-21 15:07:26 +08:00
|
|
|
|
# API文档
|
|
|
|
|
---
|
|
|
|
|
## 基本介绍
|
|
|
|
|
trustie平台同步其他平台数据的相关接口,如Educode、Openl,在获得许可权限后,如下接口可在其他任何平台调用。
|
|
|
|
|
|
|
|
|
|
#### token认证
|
|
|
|
|
token在trustie控制台下通过Setting.api_token获取,获取后可放环境变量中或者某个配置文件中
|
|
|
|
|
|
|
|
|
|
#### 同步用户数量、开源项目数量、实训项目数量
|
|
|
|
|
```
|
|
|
|
|
PUT homes/sync_count
|
|
|
|
|
```
|
|
|
|
|
*示例*
|
|
|
|
|
```
|
|
|
|
|
curl -X PUT http://localhost:3001/api/v1/homes/sync_count \
|
|
|
|
|
-d "token=34c82f51e0b699d9d16d70fd6497c9b1e4821d6ea3e872558a6537a091076b8e" \
|
|
|
|
|
-d "type=project" | jq
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
请求参数说明:
|
|
|
|
|
|
|
|
|
|
token(requires): String,权限验证
|
|
|
|
|
|
2019-10-25 22:41:10 +08:00
|
|
|
|
type(requires): String;同步的类型,取值范围: {user(用户) | project(开源项目) | practical_training_project(实训项目) | school(应用高校)}
|
2019-10-21 15:07:26 +08:00
|
|
|
|
|
|
|
|
|
number(optional): Integer;同步数量, 该参数可选,不传时,后台默认值为1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
返回值
|
|
|
|
|
```
|
|
|
|
|
{
|
|
|
|
|
"status": 1,
|
|
|
|
|
"message": "token is invalid!"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
#### 同步动态新闻
|
|
|
|
|
```
|
|
|
|
|
PUT homes/sync_news
|
|
|
|
|
```
|
|
|
|
|
*示例*
|
|
|
|
|
```
|
|
|
|
|
curl -X PUT http://localhost:3001/api/v1/homes/sync_news \
|
|
|
|
|
-d "token=34c82f51e0b699d9d16d70fd6497c9b1e4821d6ea3e872558a6537a091076b8e" \
|
|
|
|
|
-d "title=“基于OpenI海参的视频编码大赛”海口启动" \
|
|
|
|
|
-d "simple_intruduce=2019年8月31日下午,“AVS工作组第70次会议暨AI标准工作组第8次会议”闭幕式在海口召开,会上启动了“基于OpenI海参的视频编码大赛”,哈尔滨工业大学范晓鹏教授介绍了大赛背景、选题及参赛流程等信息,正式开启大赛参赛团队招募。" \
|
|
|
|
|
-d "remote_url=https://www.openi.org.cn/html/2019/dongtai_0903/255.html" | jq
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
请求参数说明:
|
|
|
|
|
cover_remote_url(optional): String, 封面访问地址
|
|
|
|
|
|
|
|
|
|
category_id(optional): Integer, 分类ID
|
|
|
|
|
|
|
|
|
|
content(optional): String, 新闻内容
|
|
|
|
|
|
|
|
|
|
title(requires): String, 新闻标题
|
|
|
|
|
|
|
|
|
|
simple_intruduce(requires): String, 新闻简介
|
|
|
|
|
|
|
|
|
|
remote_url(requires): String, 新闻访问地址
|
|
|
|
|
|
2019-10-22 11:25:44 +08:00
|
|
|
|
platform(requires): String, 该条数据的来源{educoder | trusite | ihub | gcc | openi |toschina | military | jiaotong_university}; 如educoder说明是来源educoder平台
|
|
|
|
|
|
2019-10-21 15:07:26 +08:00
|
|
|
|
|
|
|
|
|
返回值
|
|
|
|
|
```
|
|
|
|
|
{
|
|
|
|
|
"status": 1,
|
|
|
|
|
"message": "token is invalid!"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
---
|