/api/v1/{Project_token}/{ProjectUnit_token}/field
GET|POST
application/form-data
columns(string)
要讀取的欄位Key;json string(選用)
預設:讀取所有的欄位Key
Note:URL Encode json string if Http Method is GETvar columns = [ "name", "age", "sex" ]; JSON.stringify(columns);
keyAPI金鑰;設定如勾選[驗證金鑰]時為必要(選用|必要)請勿於公開資訊端使用API金鑰。若於Client公開資訊端使用,請自行評估其風險及可行性或將程式碼混淆加密壓縮。
application/json
Example Value{ "result": true, "message": "", "data": [ { "key": "field_1", "name": "科目名稱", "type": "文字", "required": true, "validExist": false, "isValid": true, "readOnly": false, "regex": "", "initValue": "", "remark": "", "textMaxLength": 0, "intMini": 0, "intMax": 0, "item": [], "bindField": { "Project_token": "", "ProjectUnit_token": "", "ProjectUnit_security_code": "", "ProjectUnitField_key": "", "filterField": "", "filterFieldType": "", "filterFieldValue": "", "sortField": "", "sortFieldType": "ASC", "style": "DropDownList" }, "bind2Field": { "Project1_token": "", "ProjectUnit1_token": "", "ProjectUnit1_security_code": "", "Project2_token": "", "ProjectUnit2_token": "", "ProjectUnit2_security_code": "", "ProjectUnit1Field_key": "", "ProjectUnit2Field_key": "", "filterField1": "", "filterField1Type": "", "filterField1Value": "", "sortField1": "", "sortField1Type": "ASC", "filterField2": "", "filterField2Type": "", "filterField2Value": "", "sortField2": "", "sortField2Type": "ASC" }, "file": { "maxSize": 0, "extension": "" }, "image": { "width": 0, "height": 0, "maxWidth": 0, "maxHeight": 0 }, "sort": 1, "colShow": true, "colWidth": 0, "colAlign": "Left", "tbSortType": "ASC", "tbSort": false, "tbSortPriority": 0, "apiAdd": true, "apiUpdate": true, "apiRead": true, "apiDelete": true, "enable": true } ], "validResult": true, "validMessage": "", "fields": [] }
resulttrue:回傳狀態成功|false:回傳狀態失敗(bool)message回傳狀態失敗訊息(string)data回傳資料(object)validResulttrue:form-data驗證成功|false:form-data驗證失敗(bool)validMessageform-data欄位驗證失敗訊息(string)StatusCode回傳狀態碼(int)fieldsform-data欄位驗證失敗訊息(array[object])[ { "Key": "key", "Value": { "key": "key", "name": "API金鑰", "value": null, "result": false, "message": "缺少API金鑰欄位參數" } } ]
curl https://www.db2sys.com.tw/api/v1/{Project_token}/{ProjectUnit_token}/{security_code}/field?fkey={fkey}
var formdata = new FormData(); formdata.append('fkey', '[fkey]欄位值'); //要取得的欄位key名稱;選用 $.ajax({ url: 'https://www.db2sys.com.tw/api/v1/{Project_token}/{ProjectUnit_token}/{security_code}/field', type: 'POST', processData: false, contentType: false, data: formdata, success: function(response) { if (response.result) { //執行成功 callback(response.data); } else { //取得失敗資訊 alert(response.message); //取得欄位驗證資訊 $.each(response.fields, function(index, field) { console.log(field); }); } }, error: function(xhr, ajaxOptions, thrownError) { console.log(xhr.status + ':' + thrownError); } });
var formdata = new FormData(); formdata.append('fkey', '[fkey]欄位值'); //要取得的欄位key名稱;選用 axios .post('https://www.db2sys.com.tw/api/v1/{Project_token}/{ProjectUnit_token}/{security_code}/field', formdata) .then(response => { if (response.data.result) { //執行成功 callback(response.data.data); } else { //取得失敗資訊 alert(response.data.message); //取得欄位驗證資訊 $.each(response.data.fields, function(index, field) { console.log(field); }); } }) .catch(function (error) { console.log(error); });