|  |  | ## 1.1 Personal Data API 概述 | 
|  |  | - Personal Data API 提供更新个人中心数据接口 | 
|  |  | - Personal Data API 查询、更新接口,具体的接口如下: | 
|  |  | -  新增 | 
|  |  | -  查询、更新单个personal data | 
|  |  | -  查询用户相关的personal data | 
|  |  | - 新增Personal Data接口:https://{site}/portal/api/v2/personal_data/{bundle} POST | 
|  |  | - 删除、更新、查询单个reosurce接口:[https://{site}/portal/api/v2/personla_data/{bundle}/{uuid}](https://note.youdao.com/) GET, PATCH, DELETE | 
|  |  | - 查询用户相关的personal_data接口: [https://{site}/portal/api/v2/personal_data?_format=json](https://note.youdao.com/) GET | 
|  |  | - 如需要额外接口满足项目需求,可以通过后台使用**Portal Views**配置 | 
|  |  |  | 
|  |  | ## 1.2 新增个人数据 | 
|  |  |  | 
|  |  | ``` | 
|  |  | POST /portal/api/v2/personal_data/{bundle} HTTP/1.1 | 
|  |  | Host: etl.dd:8083 | 
|  |  | Content-Type: application/vnd.api+json | 
|  |  | Authorization: Bearer 50c8f237ecc91ac3f151e9d3cc615726 | 
|  |  | Accept: application/vnd.api+json | 
|  |  |  | 
|  |  | { | 
|  |  | "data": { | 
|  |  | "type": "personal_data--{bundle}", | 
|  |  | "attributes": { | 
|  |  | "title": "本月工资明细", | 
|  |  | "fields": "[\"工资明细\",\"项目金额\",\"发放月份\"]", | 
|  |  | "data":"[{\"gzmx\":\"200\",\"xmje\":\"3000\",\"ffyf\":\"2018-7\"},{\"gzmx\":\"200\",\"xmje\":\"4000\",\"ffyy\":\"2018-7\"},{\"gzmx\":\"200\",\"xmje\":\"5022\",\"ffyy\":\"2018-7\"}]", | 
|  |  | "account":"20189828", | 
|  |  | "status":1, | 
|  |  | "uuid":"18926ba9-4a93-429d-ae63-27836af5d369", | 
|  |  | "weight":1 | 
|  |  | } | 
|  |  | } | 
|  |  | } | 
|  |  | ``` | 
|  |  |  | 
|  |  | ## 1.3.1.Personal data API 更新单个数据的请求参数 | 
|  |  | 具体的字段如下: | 
|  |  | 参数名	 | 类型 | 是否必需	 | 描述 | 
|  |  | ---|---|--|----|--- | 
|  |  | type | string | 是 | bundle参数:cw、zc、tsxx、ykt、dzyj、jbxx、ky,详情参考下表 | 
|  |  | title | string | 是 | 信息标题 | 
|  |  | account | string | 是 | 关联的用户学工号 | 
|  |  | uuid | string | 是 | 系统会提供一个默认的uuid,使用此uuid更新数据。 | 
|  |  | fields | json | 是 | 数据的列的字段名称,格式为转义后的json数据 | 
|  |  | data | json | 是 |  每一行的数据,使用转移后的json格式数据,数据对应fields定义的名称 | 
|  |  | status | int | 否 | 此资源是否发布,1)如果为0,则不发,2)如果为1,则发布。 | 
|  |  | weight | int | 否 | 信息排序 | 
|  |  |  | 
|  |  | **Bundle列表** | 
|  |  | key	 | 描述 | 
|  |  | ---|--- | 
|  |  | cw | 财务 | 
|  |  | zc | 资产 | 
|  |  | tsxx | 图书借阅信息 | 
|  |  | ykt | 一卡通 | 
|  |  | dzyj | 电子邮件 | 
|  |  | jbxx | 基本信息 | 
|  |  | ky | 科研 | 
|  |  |  | 
|  |  | **Fields结构** | 
|  |  | 类型|项目 | fields | weight |data | 
|  |  | ---|---|---|---|--- | 
|  |  | 我的财务|本月工资| [\"工资明细\",\"项目金额\",\"发放月份\"]| 1 |{} | 
|  |  | 我的财务|工资合计 | [\"年度\",\"月份\",\"应发合计\",\"实发合计\"] |2 | {} | 
|  |  | 我的科研|项目 | [\"项目编号\",\"项目名称\",\"项目性质\",\"研究类别\"] |1 |{} | 
|  |  | 我的科研|论文 | [\"第一作者名称\",\"论文中文名称\",\"发表日期\",\"论文类型\"] |2 |{} | 
|  |  | 我的科研|专利 | [\"专利成果名称\",\"专利类型\",\"专利范围\",\"专利状态\"] |3 |{} | 
|  |  | 我的科研|著作 | [\"著作中文名称\",\"出版社\",\"出版日期\",\"著作字数\"] |4 |{} | 
|  |  | 我的科研| 获奖 |[\"第一完成人姓名\",\"获奖成果名称\",\"获奖级别\",\"获奖日期\"] |5 |{} | 
|  |  | 我的图书| 借阅明细 |[\"书名\",\"借出日期\",\"应还日期\"] |1 |{} | 
|  |  | 我的资产| 资产信息 |[\"保管人\",\"资产分类名称\",\"单价\",\"原值\",\"使用部门名称\",\"购置时间\"] |1 |{} | 
|  |  | 我的图书 | 借阅明细 |[\"书名\",\"借出日期\",\"应还日期\"] |1 |{} | 
|  |  | 一卡通信息 | 一卡通流水 |[\"书名\",\"借出日期\",\"应还日期\"] |1 |{} | 
|  |  | ## 1.4. 查询单个数据 | 
|  |  | ``` | 
|  |  | GET /portal/api/v2/personal_data/{bundle}/{uuid} HTTP/1.1 | 
|  |  | Host: portal.xx.edu.com.cn | 
|  |  | Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j | 
|  |  | ``` | 
|  |  | ## 1.5.查询当前用户自己创建的所有数据 | 
|  |  | ``` | 
|  |  | GET /portal/api/v2/personal_data/me?_format=json HTTP/1.1 | 
|  |  | Host: portal.xx.edu.com.cn | 
|  |  | Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j | 
|  |  |  | 
|  |  | account={value}&uuid={value}&title={title}&page={}&items_per_page={} | 
|  |  | ``` | 
|  |  | ## 1.6.获取当前登录用户的数据 | 
|  |  | ``` | 
|  |  | GET /portal/api/v2/personal_data?_format=json HTTP/1.1 | 
|  |  | Host: portal.xx.edu.com.cn | 
|  |  | Authorization: Bearer 39aec9c68b679d43de6803e0f14c223j | 
|  |  |  | 
|  |  | uuid={value}&title={title}&page={}&items_per_page={}&type={value} | 
|  |  | ``` | 
|  |  | ## 1.7.查询数据的请求参数说明 | 
|  |  | 具体的字段如下: | 
|  |  | 参数名	 | 类型 | 是否必需	 | 描述 | 
|  |  | ---|---|--|----|--- | 
|  |  | title | string | 否 | 根据关键字搜索相关性的数据 | 
|  |  | account | int | 否 | 用户账号 | 
|  |  | type | string | 否 | bundle值 | 
|  |  | uuid | string | 否 | uuid | 
|  |  |  | 
|  |  | ## 1.8. 查询数据的响应信息 | 
|  |  |  | 
|  |  | ``` | 
|  |  | [ | 
|  |  | { | 
|  |  | "uuid": "875cf830-b671-4432-994b-2ed76278d6aa", | 
|  |  | "id": "1", | 
|  |  | "title": "召开校职工大会", | 
|  |  | "fields": "[\"工资明细\",\"项目金额\",\"发放月份\"]", | 
|  |  | "data": "[{\"gzmx\":\"200\",\"xmje\":\"3000\",\"ffyf\":\"2018-7\"},{\"gzmx\":\"200\",\"xmje\":\"4000\",\"ffyy\":\"2018-7\"},{\"gzmx\":\"200\",\"xmje\":\"5022\",\"ffyy\":\"2018-7\"}]", | 
|  |  | "created": "2020-07-22T14:03:35+0800", | 
|  |  | "changed": "2020-07-22T14:03:35+0800" | 
|  |  | } | 
|  |  | ] | 
|  |  | ``` | 
|  |  | ## 1.9.1.响应信息字段说明 | 
|  |  | 具体的字段如下: | 
|  |  | 参数名	 | 类型 	 | 描述 | 
|  |  | ---|---|--|---- | 
|  |  | type | string  | 类型 | 
|  |  | title | string  | 标题 | 
|  |  | uuid | int  | uuid | 
|  |  | fields | string | 自定义数据字段 | 
|  |  | data | string  | 数据集合 | 
|  |  | created | date  | 创建时间 | 
|  |  | account | string  | 是否默认开启,1为开启,当查询系统默认订阅列表时可用。 | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  |