元數據
獲取實體列表
- API 地址:
metadata/entity - HTTP 方法:GET
- 授權方式:通用授權
請求參數
| 參數 | 類型 | 是否必須 | 參數說明 |
|---|---|---|---|
| type | int | 否 | 實體類型,默認為 0 返回全部,0 = 全部,1 = 系統實體,2 = 自定義實體 |
返回數據示例
{
"error_code": 0,
"error_msg": "調用成功",
"data": [{
"code" 2,
"entity": "Account",
"name": "客戶",
"type": 1,
"name_field": "accountName"
}, {
"code": 3,
"entity": "Contact",
"name": "聯系人",
"type": 1,
"name_field": "contactName"
}]
}
返回數據說明
| 字段 | 類型 | 字段說明 |
|---|---|---|
| code | int(3) | 實體代碼,如客戶的實體代碼為 2 |
| entity | string | 實體的內部名稱 |
| name | string | 實體的顯示名稱 |
| type | int | 實體類型,1 = 系統實體,2 = 自定義實體 |
| name_field | string | 主顯字段 |
獲取實體字段列表
- API 地址:
metadata/field - HTTP 方法:GET
- 授權方式:通用授權
請求參數
| 參數 | 類型 | 是否必須 | 參數說明 |
|---|---|---|---|
| type | int | 否 | 字段類型,默認為 0 返回全部,0 = 全部,1 = 系統字段,2 = 自定義字段 |
| entity | string | 是 | 實體內部名稱,即要獲取哪個實體的字段 |
返回數據示例
{
"error_code": 0,
"error_msg": "調用成功",
"data": [{
"field": "accountName",
"name": "客戶名稱",
"type": 1,
"data_type": "string",
"nullable": false,
"creatable": true,
"updatable": true
}, {
"field": "owning_user",
"name": "所屬用戶",
"type": 1,
"data_type": "reference",
"reference_to": "User",
"nullable": false,
"creatable": true,
"updatable": true
}]
}
返回數據說明
| 字段 | 類型 | 字段說明 |
|---|---|---|
| entity | string | 實體內部名稱 |
| name | string | 實體顯示名稱 |
| type | int | 實體類型,1 = 系統實體,2 = 自定義實體 |
| data_type | string | 字段的數據類型 |
| nullable | boolean | 是否允許為空值 |
| creatable | boolean | 是否可以在創建時指定值(不可創建的值通常用于自動填充類字段,例如記錄ID應該由系統自動生成而非自己指定) |
| updatable | boolean | 是否可以更新此字段的值。注意:在使用 */update 接口時,如傳入此類字段將會被忽略 |
| reference_to | string | 僅在數據類型為 reference 時有效,意為此字段關聯的實體 |
工具
我們編寫了一個 元數據獲取工具,你可以直接使用。