dataset - Luphia/SIMPLE GitHub Wiki

#dataset

基本資訊

項目 描述
路徑 /dataset/
路徑 /dataset/:table
路徑 /dataset/:table/:id
  • 測試工具:Google Chrome 的應用程式『REST console』

newDataset

測試案例

url

http://10.10.23.212/excelparser/?label=testUpload01

method: POST

Input

需上傳一個xlsx檔

Output

{
    "result": 1,
    "message": "",
    "data": [{
        "label": "Data",
        "path": "/dataset/lk7T0FRONx5V8Yjg/"
    }]
}

LIST3

測試案例(1)

url

http://10.10.23.212/dataset/

method: GET

Output

{
    "result": 1,
    "message": "List All Table Successful",
    "data": [{
        "name": "testA01",
        "label": "testA01"
    }, {
        "name": "testUserTable",
        "label": "testUserTable"
    }]
}

測試案例(2)

url

http://10.10.23.212/dataset/?sql=SELECT * FROM testUserTable
http://10.10.23.212/dataset/?sql=SELECT id, name FROM testUserTable

method: GET

GET3

測試案例

url

http://10.10.23.212/dataset/testUserTable

method: GET

Output

  • success
{
    "result": 1,
    "message": "Get Table Schema Successful",
    "data": {
        "columns": {
            "id": "Number",
            "name": "String",
            "image": "Binary",
            "createDate": "Date"
        },
        "name": "testUserTable",
        "strick": false,
        "table_length": 0
    }
}

POST3

測試案例

url

http://10.10.23.212/dataset/testUserTable

method: POST

table中欄位的型態類型:

欄位型別 描述
String 字串型態
Number 數值型態
Date 日期型態
Boolean 布林型態
JSON JSON格式
Binary 二進位型態
其他 如果輸入非上述所列之型別均一率當成『String』類型處理

Input

{
	"id": "Integer",
	"name": "varchar",
	"image": "byte"
}

Output

  • success
{
    "result": 1,
    "message": "Create Table Successful",
    "data": true
}

PUT3

測試案例

url

http://10.10.23.212/dataset/testUserTable

method: PUT

Input

{
	"id": "Number",
	"name": "String",
	"image": "Binary",
	"createDate": "Date"
}

Output

  • success
{
    "result": 1,
    "message": "Modify Table Successful",
    "data": true
}

DELETE3

測試案例

url

http://10.10.23.212/dataset/testUserTable

method: DELETE

Output

  • success
{
    "result": 1,
    "message": "Delete Table Successful",
    "data": true
}

LIST4

測試案例

url

http://10.10.23.212/dataset/testUserTable/?q=SELECT * FROM testUserTable
http://10.10.23.212/dataset/testUserTable/?sql=SELECT id, name FROM testUserTable

method: GET

Output

  • success
{
    "result": 1,
    "message": "List Data to testUserTable Table Successful",
    "data": {
        "start": 4,
        "pick": 6,
        "end": null,
        "list": [{
            "_id": null
        }, {
            "_id": null
        }, {
            "id": 3,
            "name": "王五",
            "image": 1100101000010101,
            "createDate": "2015-03-17T00:00:00.000Z",
            "_id": 4
        }, {
            "id": 2,
            "name": "李四",
            "image": 1100101000010101,
            "createDate": "2015-02-17T00:00:00.000Z",
            "_id": 3
        }, {
            "id": 1,
            "name": "張三",
            "image": "",
            "createDate": "2015-02-15T00:00:00.000Z",
            "_id": 2
        }, {
            "id": 1,
            "name": "張三",
            "image": 1001011101100101,
            "createDate": "2015-02-15T00:00:00.000Z",
            "_id": 1
        }]
    }
}

GET4

測試案例

url

http://10.10.23.212/dataset/testUserTable/3

method: GET

Output

  • success
{
    "result": 1,
    "message": "Get Data from testUserTable Table Successful",
    "data": {
        "id": 2,
        "name": "李四",
        "image": 1100101000010101,
        "createDate": "2015-02-17T00:00:00.000Z",
        "_id": 3
    }
}

POST4

測試案例

url

http://10.10.23.212/dataset/testUserTable/

method: POST

Input

{
	"id": 1,
	"name": "張三",
	"image": "",
	"createDate": "2015-02-15"
}

Output

  • success
{
    "result": 1,
    "message": "Insert Data to testUserTable Table Successful",
    "data": "3"
}

PUT4

測試案例(1)

url

http://10.10.23.212/dataset/testUserTable/4

method: PUT

Input

{
	"id": 1,
	"name": "張三寶",
	"image": "1001011101011100",
	"createDate": "2015-02-15"
}

Output

  • success
{
    "result": 1,
    "message": "Update or Insert Data to testUserTable Table Successful",
    "data": true
}

測試案例(2)

url

http://10.10.23.212/dataset/testUserTable/?q=UPDATE testUserTable SET name='李四端' WHERE id=2

method: PUT

Input


Output

  • success

DELETE4

測試案例

url

http://10.10.23.212/dataset/testUserTable/2

method: DELETE

Output

  • success
{
    "result": 1,
    "message": "Delete Data to testUserTable Table Successful",
    "data": true
}