# 素材庫接口文檔
##### 作者:黃文榕
##### 時間:2020 - 3 - 31
##### 版本:V4.0.0
##### 修改:
|更新時間|更新人|作用|
|--|--|--|
2020-04-27 | 李小琳 | 根據V4.1.1需要,增加是否同步過個人素材庫接口(/wechat_api/materiallibrary/isSynced)和同步個人素材庫接口(/wechat_api/materiallibrary/syncMyselfData)
2020-04-29 | 黃文榕 | V4.2.0升級接口 /getList增加分頁
2020-05-19 | 黃文榕 | V4.3.0升級接口 更新/updateFolderOrFileTitle
2020-06-05 | 黃文榕 | V4.4.0升級接口 /saveMaterialLibrary
### 獲取素材列表
- url: /wechat_api/materiallibrary/getList
- 調用方式: get
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- |---| ---
type | Integer | Y | 素材類型 1-圖文鏈接,2-視頻,3-小程序,4-圖片,5-文件
isPublic | Integer | Y | 是否是公共的 0-是私人 1-是公共 2-部門
departId | Integer | N | 部門id ==當isPublic=2時必傳==
pageNo| Integer | Y | 頁碼
limit| Integer | Y | 數量
title| String| N |名稱
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
id | Long | 素材庫Id
adminUserId | Long | 用戶Id
xml | String | 發送給騰訊中使用,xml格式
url | String | 素材的地址
imageUrl | String | 封面圖的地址
title | String | 素材的標題
synopsis | String | 素材的摘要
source | String | 來源
type | Integer | 素材類型 1-圖文鏈接,2-視頻,3-小程序
isPublic | Integer | 是否是公共的 0-是私人 1-是公共
isFolder | Integer | 是否是文件夾 0-不是 1-是文件夾
departId | Integer | 部門id isPublic=2時使用
folderId | Integer | 文件夾id.二級文件. isPublic=2時,文件夾下的文件歸屬
fileSize | Integer | 文件大小
aesKey | String | cdn aesKey
cdnThumbUrl | String | cdn fileid
### 編輯/收藏/添加素材
- url: /wechat_api/materiallibrary/saveMaterialLibrary
- 調用方式: post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
id | Long | N | 素材庫Id,更新時傳
xml | String | N | 發送給騰訊中使用,xml格式,收藏時需要
url | String | Y | 素材的地址
imageUrl | String | N | 封面圖的地址(視頻暫無該功能)
title | String | Y | 素材的標題
synopsis | String | N | 素材的摘要
source | String | N | 來源
type | Integer | Y| 素材類型 1-圖文鏈接,2-視頻,3-小程序
isPublic | Integer | Y | 是否是公共的 0-是私人 1-是公共
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
data | json |
data:
屬性名 | 類型| 備注
---|--- | ---
id | Long | 素材庫Id
adminUserId | Long | 用戶Id
xml | String | 發送給騰訊中使用,xml格式
url | String | 素材的地址
imageUrl | String | 封面圖的地址
title | String | 素材的標題
synopsis | String | 素材的摘要
source | String | 來源
type | Integer | 素材類型 1-圖文鏈接,2-視頻,3-小程序
isPublic | Integer | 是否是公共的 0-是私人 1-是公共
isFolder | Integer | 是否是文件夾 0-不是 1-是文件夾
departId | Integer | 部門id isPublic=2時使用
folderId | Integer | 文件夾id.二級文件. isPublic=2時,文件夾下的文件歸屬
fileSize | Integer | 文件大小
aesKey | String | cdn aesKey
cdnThumbUrl | String | cdn fileid
### 刪除/批量刪除標簽
- url: /wechat_api/materiallibrary/deleteMaterial
- 調用方式: post
- 備注:這個接口沒有自動更新順序,需要自行調用更新順序的接口
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
deleteIds | List | Y | 刪除素材的Id
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
### 設置為公有/私人的/部門
- url: /wechat_api/materiallibrary/saveToPublicOrMyself
- 調用方式:post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
isPublic | Integer | Y | 想轉成的類型,0-是私人 1-是公共 2-部門
id | Long | Y | 素材Id
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
### 置頂
- url: /wechat_api/materiallibrary/updateSort
- 調用方式:post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
isPublic | Integer | Y | 想轉成的類型,0-是私人 1-是公共
id | Long | Y | 素材Id
type | Integer | Y | 素材類型 1-圖文鏈接,2-視頻,3-小程序
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
### 新建文件夾
- url: /wechat_api/materiallibrary/addFolder
- 調用方式:post /json
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
isPublic | Integer | Y | 想轉成的類型,0-是私人 1-是公共,2-部門
type | Integer | Y | 素材類型 1-圖文鏈接,2-視頻,3-小程序,4-圖片,5-文件
title | Integer | Y | 文件夾命名
source| String | N | 來源
##### 請求示例:
{
"isPublic":1,
"type":"4",
"title":"文件夾命名1",
"type":5
}
### 修改文件夾名稱
- url: /wechat_api/materiallibrary/updateFolderOrFileTitle
- 調用方式:post /json
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
isPublic | Integer | Y | 想轉成的類型,0-是私人 1-是公共,2-部門
type | Integer | Y | 素材類型 4-圖片,5-文件
title | Integer | Y | 文件夾命名
id| Long | Y | 主鍵id
isFolder| Integer | Y | 是否文件夾
departId | Integer | N | 部門id
##### 請求示例:
{
"isPublic":1,
"type":"4",
"title":"文件夾命名1",
"id":123,
"isFolder":1
}
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
### 查詢該文件夾下的文件或圖片數據
- url: /wechat_api/materiallibrary/getFolderList
- 調用方式:get
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
id | Long | Y | 文件夾的id
pageNo| Integer | Y | 頁碼
limit| Integer | Y | 數量
title| String| N |名稱
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
data | List | 圖片或文件
id | Long | 素材庫Id
adminUserId | Long | 用戶Idid
xml | String | 發送給騰訊中使用,xml格式
url | String | 素材的地址
imageUrl | String | 封面圖的地址
title | String | 素材的標題
synopsis | String | 素材的摘要
source | String | 來源
type | Integer | 素材類型 1-圖文鏈接,2-視頻,3-小程序
isPublic | Integer | 是否是公共的 0-是私人 1-是公共 2部門
isFolder | Integer | 是否是文件夾 0-不是 1-是文件夾
departId | Integer | 部門id isPublic=2時使用
folderId | Integer | 文件夾id.二級文件. isPublic=2時,文件夾下的文件歸屬
### 添加圖片或文件
- url: /wechat_api/materiallibrary/addFileOrImg
- 調用方式:post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
folderId | Long | N | 如果是新增在文件夾下的則需要填文件夾的id
url | String | Y | 素材地址
title | String | Y | 文件或圖片名
type | Integer | Y | 素材類型 1-圖文鏈接,2-視頻,3-小程序,4-圖片,5-文件
isPublic | Integer | Y | 是否是公共的 0-是私人 1-是公共 2部門
sort | Integer | N | 排序
source | String | N | 來源
fileSize | Integer | Y | 文件大小
##### 請求示例:
{
"folderId":"2837",
"url":"https://siyouyunsy-1253559996.file.myqcloud.com/common/BUG44/signature%3D73511e8a865c6f36afd13f2b6e6ac0bceba4f44d",
"title":"驚呆",
"type":5,
"isPublic":2
}
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
### 移動圖片或文件
- url: /wechat_api/materiallibrary/moveFileOrImg
- 調用方式:post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
folderId | Long | N | 如果是移動到該文件夾下,則必填該參數
id | Long | Y | 圖片或文件id
##### 請求示例:
{
"id":123
}
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
data | Object | 返回數據 (內容同獲取素材庫數據一致)
### V4.1.1 查詢是否同步過個人素材庫數據
- url: /wechat_api/materiallibrary/isSynced
- 調用方式:get
##### 傳參:無
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
data | boolean| true:同步過,false:未同步過
##### 出參示例:
```
{
"code":?200,
"msg":?"操作成功!",
"data":?true
}
```
### V4.1.1 同步個人舊素材庫數據
- url: /wechat_api/materiallibrary/syncMyselfData
- 調用方式:post
##### 傳參:
屬性名 | 類型| 是否必要 | 備注
---|--- | --- | ---
outSynced| Boolean| N | true:不再同步
##### 出參:
屬性名 | 類型| 備注
---|--- | ---
code | Integer | 狀態碼
msg | String | 消息
data | Object|
##### 出參示例:
```
{
"code":?200,
"msg":?"操作成功!",
"data":?null
}
或
{
"code":?400,
"msg":?"已同步過個人素材庫數據,請勿重復同步!",
"data":?null
}
```
- 首頁
- 系統登錄注冊模塊
- 登錄模塊
- 注冊模塊
- 忘記密碼模塊
- 功能首頁渲染模塊
- 會話面板模塊
- 微信號登錄模塊
- 會話聯系人模塊
- 通訊錄模塊
- 聊天窗口模塊
- 快捷回復模塊
- 客戶錄入模塊
- 群管理模塊
- 歷史消息面板模塊
- 群發助手面板模塊
- 群發設置模塊
- 群發管理模塊
- 群發演示模塊
- 朋友圈面板模塊
- 發朋友圈模塊
- 朋友圈互動模塊
- 朋友圈歷史記錄模塊
- 客戶管理面板模塊
- 客戶查詢模塊
- 服務記錄模塊
- 批量標簽模塊
- 標簽管理模塊
- 昵稱管理模塊
- 個性稱呼模塊
- 批量導入客戶模塊
- 報表面板模塊
- 微信好友報表
- 被刪好友報表
- 新增好友報表
- 添加好友報表
- 服務記錄報表
- 轉賬記錄報表
- 紅包統計報表
- 會話統計報表
- 電話統計報表
- 標簽統計報表
- 賬號管理面板模塊
- 微信號管理模塊
- 部門管理模塊
- 子賬號管理模塊
- 在線日志模塊
- 機器人模塊
- 自動通過好友模塊
- 小程序商城模塊
- 微信號分配模塊
- 幫助中心面板模塊
- 個人中心模塊
- 我的賬號模塊
- 系統設置模塊
- 第三方能力接口對接
- 第三方登錄模塊
- 聯系人模塊
- 系統賬號模塊
- 服務版本接口迭代說明
- 素材庫
- 好友去重
- V群模塊