文件

1. 获取文件列表

根据{binder_id}获取文件列表显示文件结构目录

GET/ {binder_id} /files

请求:

GET /BIAJqlZHXWMB6O4JI5fv6Q4/files

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "files": [
            {
                "file_id": "650aee51-52f7-47df-89e8-5b7394179bbc",
                "name": "incoming.html",
                "created_time": 1435359926443,
                "updated_time": 1435360933608,
                "file_size": 23153
            },
            {
                "file_id": "7676930b-b71d-4f35-825d-84e7e4c01dc1",
                "name": "quickbooks.htm",
                "created_time": 1435362150028,
                "updated_time": 1435362151912,
                "file_size": 13754
            }
        ],
        "folders": [
            {
                "folder_id": 91,
                "name": "level1",
                "created_time": 1437514459629,
                "updated_time": 1437678306449,
                "files": [
                    {
                        "file_id": "78a91635-5f36-498e-8722-517124b9921e",
                        "name": "web_hooks.docx",
                        "created_time": 1437514509995,
                        "updated_time": 1437514538401,
                        "file_size": 3422690
                    }
                ],
                "folders": []
            },
            {
                "folder_id": 678,
                "name": "level1-1",
                "created_time": 1437676498091,
                "updated_time": 1437692636197,
                "files": [
                    {
                        "file_id": "b8485cbb-d780-4c83-8eec-2601cb98da5e",
                        "name": "mobile_apps.vsd",
                        "created_time": 1437692341585,
                        "updated_time": 1437692341585,
                        "file_size": 241643
                    },
                    {
                        "file_id": "3b5912a9-3558-4314-a8b1-4aabb940453d",
                        "name": "chat_spec.docx",
                        "created_time": 1437692384271,
                        "updated_time": 1437692394655,
                        "file_size": 745434
                    }
                ],
                "folders": [
                    {
                        "folder_id": 932,
                        "name": "level2",
                        "created_time": 1437692444327,
                        "updated_time": 1437692563155,
                        "files": [
                            {
                                "file_id": "15a99168-95d1-4a1b-a099-b8a8d237800e",
                                "name": "BeTalk API 2.0.docx",
                                "created_time": 1437692548675,
                                "updated_time": 1437692563155,
                                "file_size": 424254
                            }
                        ],
                        "folders": []
                    },
                    {
                        "folder_id": 981,
                        "name": "level2-1",
                        "created_time": 1437692566222,
                        "updated_time": 1437692636197,
                        "files": [
                            {
                                "file_id": "f692d935-c306-479e-bd76-65e773992e8d",
                                "name": "plants.docx",
                                "created_time": 1437692579014,
                                "updated_time": 1437692592331,
                                "file_size": 1234123
                            },
                            {
                                "file_id": "5cc430a3-7109-4148-b00c-21ab5482f73d",
                                "name": "Test_DNA.docx",
                                "created_time": 1437692626827,
                                "updated_time": 1437692636197,
                                "file_size": 9442221
                            }
                        ],
                        "folders": []
                    }
                ]
            }
        ]
    }   
}

2. 上传文件

通过{binder_id} 上传文件

POST/ {binder_id} /files

URL参数

名称 类型 描述
target_folder_path String 可选:将文件上传通过逗号分隔folder_ids的文件夹路径,例如,“91,981”。默认值是讨论组的根文件夹。

表格参数数据

名称 类型 描述
File file 被上传到讨论组的实际文件

请求:

POST /B9rArkzRe094lPPiMH4UpS8/files
...
Content-Type: multipart/form-data; boundary=---------------------------9051914041544843365972754266
Content-Length: 3234
-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="file"; filename="sample.pdf"
Content-Type: application/pdf
Content of sample.pdf

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "file_id": "f692d935-c306-479e-bd76-65e773992e8d",
        "created_time": 1355782091405,
        "updated_time": 1355782091405
    }   
}

3. 下载原始文件

通过{binder_id}和{file_id}下载原始文件

GET /{binder_id}/files/{file_id}

请求:

GET /B9rArkzRe094lPPiMH4UpS8/files/f692d935-c306-479e-bd76-65e773992e8d

响应:

#Original File

4. 删除文件

根据{binder_id}和{file_id}删除。

DELETE/ {binder_id} /files/{file_id}

请求:

DELETE /B9rArkzRe094lPPiMH4UpS8/files/f692d935-c306-479e-bd76-65e773992e8d

响应:

{
    "code": "RESPONSE_SUCCESS"
}

5. 获取文件链接

根据{binder_id}和{file_id}获取链接。

GET/ {binder_id} /files/{file_id} / viewonlylink

请求:

GET /B9rArkzRe094lPPiMH4UpS8/files/f692d935-c306-479e-bd76-65e773992e8d/viewonlylink

响应:

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "file_id": "f692d935-c306-479e-bd76-65e773992e8d",
        "url": "https://www.betalk.com/v/CAEqBUxrZThOehdCdXp5BTFPa3dTMDg4RTZLdUFFY2ZHQ4ABFpADFA"
    }
}