{
  "apifoxCli": "2.2.6",
  "info": {
    "name": "Coze 知识库接口 smoke 测试"
  },
  "item": [
    {
      "name": "知识库管理",
      "item": [
        {
          "id": "kb-list",
          "name": "查看知识库列表",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/list",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "space_id", "value": "7366210605697007616", "type": "text" },
                { "key": "page_num", "value": "1", "type": "text" },
                { "key": "page_size", "value": "2", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-diagnostics",
          "name": "检测 Coze 配置",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/diagnostics",
            "body": { "mode": "urlencoded", "urlencoded": [] }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-create-negative",
          "name": "创建知识库-缺少名称校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/create",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "space_id", "value": "7366210605697007616", "type": "text" },
                { "key": "format_type", "value": "0", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-update-negative",
          "name": "修改知识库信息-无效ID校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/update",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "dataset_id", "value": "0", "type": "text" },
                { "key": "name", "value": "Smoke 不应成功", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-delete-negative",
          "name": "删除知识库-无效ID校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/delete",
            "body": { "mode": "urlencoded", "urlencoded": [{ "key": "dataset_id", "value": "0", "type": "text" }] }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-documents",
          "name": "查看知识库文件列表",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/documents",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "dataset_id", "value": "7659346836330758207", "type": "text" },
                { "key": "page", "value": "1", "type": "text" },
                { "key": "size", "value": "2", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-upload-negative",
          "name": "上传知识库文件-缺少文件校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/upload",
            "body": { "mode": "urlencoded", "urlencoded": [{ "key": "dataset_id", "value": "7659346836330758207", "type": "text" }] }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-delete-document-negative",
          "name": "删除知识库文件-无效ID校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/deleteDocument",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "dataset_id", "value": "7659346836330758207", "type": "text" },
                { "key": "document_id", "value": "0", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-update-document-negative",
          "name": "修改知识库文件信息-无效ID校验",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/updateDocument",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "dataset_id", "value": "7659346836330758207", "type": "text" },
                { "key": "document_id", "value": "0", "type": "text" },
                { "key": "document_name", "value": "Smoke 不应成功", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        },
        {
          "id": "kb-progress",
          "name": "查看文件上传解析进度",
          "type": "http",
          "metaInfo": { "type": "HTTP" },
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/x-www-form-urlencoded" }],
            "url": "{{base_url}}/p/knowledgeBase/progress",
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "dataset_id", "value": "7656644527025766415", "type": "text" },
                { "key": "document_ids[]", "value": "7656649709462274054", "type": "text" },
                { "key": "document_ids[]", "value": "7656649711444557867", "type": "text" }
              ]
            }
          },
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["pm.test('HTTP 200', function () { pm.response.to.have.status(200); });", "pm.test('JSON 响应', function () { pm.response.to.be.json; });"] } }]
        }
      ]
    }
  ]
}
