查询接口文档

查询模块接口设计文档

1. NoteController

1.1 api/query/{plat}/notes
  • 描述:新建一个Note
  • 请求方式:POST
  • 参数:

    name:name
    content:content(非必须)
    description:description
    
  • 返回:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    {
    "code": 201,
    "msg": "新建成功",
    "data": {
    "id": 22,
    "userId": 100,
    "name": "name",
    "content": "content",
    "description": "description",
    "createTime": 1474452386000,
    "category": 20
    }
    }
1.2 api/query/{plat}/notes/{noteId}
  • 描述:更新一个Note的信息,要更新哪个参数就传哪个参数
  • 请求方式:PUT
  • 参数:
    name:newname(非必须)
    description:newdescription(非必须)
    content:content (非必须)
    
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    {
    "code": 200,
    "msg": "更新成功",
    "data": {
    "id": 22,
    "userId": 100,
    "name": "newname",
    "content": "content",
    "description": "newdescription",
    "createTime": 1474453076000,
    "category": 20
    }
    }
1.3 api/query/{plat}/notes/{noteId}
  • 描述:删除一个Note
  • 请求方式:DELETE
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    {
    "code": 204,
    "msg": "删除成功",
    "data": null
    }
1.4 api/query/{plat}/notes
  • 描述:获取用户所有的Note
  • 请求方式:GET
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    {
    "code": 200,
    "msg": "获取成功",
    "data": [
    {
    "id": 19,
    "userId": 100,
    "name": "newname",
    "content": "content",
    "description": "newdescription",
    "createTime": 1474455086000,
    "category": 20
    },
    {
    "id": 23,
    "userId": 100,
    "name": "newname",
    "content": "content",
    "description": "newdescription",
    "createTime": 1474455039000,
    "category": 20
    }
    ]
    }

2.NotePropertiesController

2.1 api/query/{plat}/note/{noteId}/noteProperties
  • 描述:获取note的设置
  • 请求方式:get
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    {
    "code": 200,
    "msg": "获取成功",
    "data": [
    {
    "id": 29,
    "noteId": 19,
    "propertyId": 21,
    "propertyValue": "jdbc:hive://hhhhhh",
    "isValid": 1,
    "createTime": 1474447899000,
    "propertyName": null
    },
    {
    "id": 30,
    "noteId": 19,
    "propertyId": 24,
    "propertyValue": "yuan",
    "isValid": 1,
    "createTime": 1474450331000,
    "propertyName": null
    },
    {
    "id": 32,
    "noteId": 19,
    "propertyId": 23,
    "propertyValue": "1000",
    "isValid": 1,
    "createTime": 1474450294000,
    "propertyName": null
    }
    ]
    }
2.2 api/query/{plat}/note/{noteId}/noteProperties
  • 描述:更新一个NoteProperties
  • 请求方式:PUT
  • 参数:
  • 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    [
    { "id":29,
    "propertyId":21,
    "propertyValue": "jdbc:hive://hhhhhh"
    },
    {
    "id":30,
    "propertyId":22,
    "propertyValue": "yuan"
    },
    {
    "id":0,
    "propertyId":23,
    "propertyValue": 1000
    }
    ]
  • 返回:

    1
    2
    3
    4
    5
    {
    "code": 200,
    "msg": "更新成功",
    "data": null
    }

3.NoteContentController

3.1 /api/query/{plat}/noteContents
  • 描述:收藏NoteContent
  • 请求方式:POST
  • 参数:

    name:newname
    description:newdescription
    content:select * from table
    
  • 返回:

    1
    2
    3
    4
    5
    {
    "code": 200,
    "msg": "保存成功",
    "data": 1
    }
3.2 /api/query/{plat}/noteContents/{noteContentId}
  • 描述:更新一个NoteContent
  • 请求方式:PUT
  • 参数:
    name:newname1
    description:newdescription1
    content:select name  from table
    
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    {
    {
    "code": 200,
    "msg": "更新成功",
    "data": {
    "id": 1,
    "name": "newname1",
    "description": "newdescription1",
    "content": "select name from table",
    "resultSetId": 0,
    "userId": 100,
    "createTime": 1474439364000,
    "category": 0,
    "resultSet": null
    }
    }
3.3 /api/query/{plat}/noteContents/{noteContentId}
  • 描述:删除NoteContent
  • 请求方式:DELETE
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    {
    "code": 204,
    "msg": "删除成功",
    "data": "1"
    }
3.4 /api/query/{plat}/noteContents
  • 描述:获取用户该category下所有收藏的NoteContent
  • 请求方式:GET
  • 参数:无
  • 返回:

4.HiveQueryController

4.1 api/query/{plat}/user/note/run
  • 描述:执行语句
  • 参数:noteId content
  • 返回:
4.2 api/query/{plat}/user/note/cancel
  • 描述:取消语句的执行
  • 参数:userId noteId
  • 返回:
4.3 api/query/{plat}/note/timedRun
  • 描述:定时执行
  • 参数:noteId content time
  • 返回:

5.UdfController

5.1 /api/query/{plat}/udfs
  • 描述:新建自定义函数
  • 请求类型:POST
  • 参数:
    name:name
    description:description
    hdfsUrl:hdfsUrl
    
  • 返回:
    1
    2
    3
    4
    5
    {
    "code": 201,
    "msg": "新建成功",
    "data": 1
    }
5.2 /api/query/{plat}/udfs
  • 描述:获取自定义函数
  • 请求类型:GET
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    {
    "code": 200,
    "msg": "获取成功",
    "data": [
    {
    "id": 1,
    "name": "name",
    "description": "description",
    "hdfsUrl": "hdfsUrl",
    "userId": 100,
    "category": 20,
    "createTime": 1474456371000
    }
    ]
    }
5.3 /api/query/{plat}/udfs/{id}
  • 描述:删除自定义函数
  • 请求类型:DELETE
  • 参数:
  • 返回:
    1
    2
    3
    4
    5
    {
    "code": 204,
    "msg": "删除成功",
    "data": "1"
    }

6.PropertyController(暂时用不着)

6.1 api/query/properties
  • 描述:批量新建参数
  • 请求类型:POST
  • 参数:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    [
    {
    "name": "username",
    "description": "用户名",
    "isValid": 1,
    "category":20,//hive参数
    "defaultValue": "yuanjinyao",
    "initNeed": 1
    },
    {
    "name": "username",
    "description": "用户名",
    "isValid": 1,
    "category":30,//spark参数
    "defaultValue": "yuanjinyao",
    "initNeed": 1
    }
    ]
  • 返回:

    1
    2
    3
    4
    5
    {
    "code": 200,
    "msg": "新建成功",
    "data": 2
    }
6.2 api/query/properties/{propertiesId}
  • 描述:更新参数设置
  • 请求类型:PUT
  • 参数:
       name:newname
    description:newdescription
    defaultValue:defaultValue
    category:20
    initNeed:0
    isValid:1
    
  • 返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    {
    "code": 200,
    "msg": "更新成功",
    "data": {
    "id": 24,
    "name": "newname",
    "defaultValue": "defaultValue",
    "description": "newdescription",
    "category": 20,
    "initNeed": 0,
    "isValid": 1,
    "createTime": 1474376071000
    }
    }