Media
Upload file để gửi, tải file đính kèm, thư viện media. · 13 endpoint
- GET/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/media
- POST/media/uploads
- DELETE/media/uploads/{uploadId}
- GET/accounts/{accountId}/library/items
- POST/accounts/{accountId}/library/items
- PATCH/library/items/{uuid}
- DELETE/library/items/{uuid}
- GET/library/items/{uuid}/file
- GET/library/items/{uuid}/thumb
- GET/accounts/{accountId}/library/folders
- POST/accounts/{accountId}/library/folders
- PATCH/accounts/{accountId}/library/folders/{folderId}
- DELETE/accounts/{accountId}/library/folders/{folderId}
Tải file/ảnh/video/ghi âm của một tin (tự tải về máy nếu chưa có)
GET
/api/v1/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/mediaScope: media:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản |
threadIdpath · bắt buộc | string max 200 | ID hội thoại |
msgIdpath · bắt buộc | string max 200 | ID tin nhắn (msg_id) |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/media" \
-H "Authorization: Bearer dpk_xxx"Upload file để gửi vào chat (trả upload_id, hết hạn sau 24 giờ)
POST
/api/v1/media/uploadsScope: media:writeHai cách gửi:
- Raw body: header
X-Filename: ten-file.pdf(URL-encode nếu có dấu) +Content-Typecủa file. Ghi thẳng xuống đĩa. multipart/form-datavới trườngfile. upload_id chỉ key đã upload dùng được.
Body dạng multipart/form-data
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/media/uploads" \
-H "Authorization: Bearer dpk_xxx"Xoá file đã upload (không đợi hết hạn)
DELETE
/api/v1/media/uploads/{uploadId}Scope: media:writeTham số
uploadIdpath · bắt buộc | string max 100 |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/media/uploads/{uploadId}" \
-H "Authorization: Bearer dpk_xxx"Item trong thư viện media của tài khoản
GET
/api/v1/accounts/{accountId}/library/itemsScope: media:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
typequery · tuỳ chọn | "all" | "image" | "video" | "file" | "audio" default "all" | |
searchquery · tuỳ chọn | string max 200 | |
folder_idquery · tuỳ chọn | integer | -1 = chưa có thư mục |
pagequery · tuỳ chọn | integer ≥ 1 · default 1 | |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 200 · default 50 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/items" \
-H "Authorization: Bearer dpk_xxx"Đưa file đã upload vào thư viện
POST
/api/v1/accounts/{accountId}/library/itemsScope: media:writeTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Body (JSON)
upload_idbắt buộc | string | |
nametuỳ chọn | string max 200 | |
tagstuỳ chọn | string max 500 · default "" | |
folder_idtuỳ chọn | integer | null |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/items" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"upload_id":"string","name":"string","tags":""}'Đổi tên, tag, thư mục, yêu thích
PATCH
/api/v1/library/items/{uuid}Scope: media:writeTham số
uuidpath · bắt buộc | string max 100 |
Body (JSON)
nametuỳ chọn | string max 200 | |
tagstuỳ chọn | string max 500 | |
folder_idtuỳ chọn | integer | null | |
is_favoritetuỳ chọn | boolean | |
alt_texttuỳ chọn | string max 500 |
Lệnh mẫu
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/library/items/{uuid}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","tags":"string","folder_id":0}'Xoá item khỏi thư viện
DELETE
/api/v1/library/items/{uuid}Scope: media:writeTham số
uuidpath · bắt buộc | string max 100 |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/library/items/{uuid}" \
-H "Authorization: Bearer dpk_xxx"Tải file của item
GET
/api/v1/library/items/{uuid}/fileScope: media:readTham số
uuidpath · bắt buộc | string max 100 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/library/items/{uuid}/file" \
-H "Authorization: Bearer dpk_xxx"Ảnh thu nhỏ của item
GET
/api/v1/library/items/{uuid}/thumbScope: media:readTham số
uuidpath · bắt buộc | string max 100 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/library/items/{uuid}/thumb" \
-H "Authorization: Bearer dpk_xxx"Thư mục thư viện
GET
/api/v1/accounts/{accountId}/library/foldersScope: media:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
typequery · tuỳ chọn | string max 20 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders" \
-H "Authorization: Bearer dpk_xxx"Tạo thư mục
POST
/api/v1/accounts/{accountId}/library/foldersScope: media:writeTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Body (JSON)
namebắt buộc | string max 200 | |
colortuỳ chọn | string max 20 |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","color":"string"}'Đổi tên thư mục
PATCH
/api/v1/accounts/{accountId}/library/folders/{folderId}Scope: media:writeTham số
accountIdpath · bắt buộc | string max 200 | |
folderIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
namebắt buộc | string max 200 |
Lệnh mẫu
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders/{folderId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string"}'Xoá thư mục (file bên trong chuyển ra ngoài, không bị xoá)
DELETE
/api/v1/accounts/{accountId}/library/folders/{folderId}Scope: media:writeTham số
accountIdpath · bắt buộc | string max 200 | |
folderIdpath · bắt buộc | integer ≥ 1 |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders/{folderId}" \
-H "Authorization: Bearer dpk_xxx"