更新时间:2023-02-15 15:45:45
按顺序隐藏'id'属性,您需要将此字段声明为隐藏。
In order to hide the 'id' attribute, you need declare this field as hidden.
在YOUR_MODEL.json文件中:
In YOUR_MODEL.json file:
{
"name": "YOUR_MODEL",
.
.
.
"properties": {
// your custom properties
},
"hidden": ["id"], // this attribute specifies which attributes need to be hidden
.
.
.
}
当一个属性被声明为隐藏时,请注意:
Be aware when a property declared as hidden:
例如,如果我们有'User'模型如下:
For instance, if we have 'User' model as follows:
{
"name": "User",
.
.
.
"properties": {
"id": "string",
"name": "string",
"password": "string",
},
"hidden": ["id", "password"],
.
.
}
/ api / User
GET请求将提供具有仅'name'属性的用户列表
/api/User
GET request will provide list of Users with only 'name' attribute
但 / api / User
POST with body:
BUT, /api/User
POST with body:
{
"user" : "USER",
"password": "PASS",
"id" : "USER_PROVIDED_ID"
}
正文中提供的用户将使用其中的值进行保存。
the user provided in the body will be saved with the values in it.