我创建了一个模型(slc环回:模型客户),完成' slc run'并浏览到http://localhost:3000/explorer/。我看到了两个顾客'和'用户'楷模。但我无法弄清楚如何向User模型添加实例。我选择用户 - >发布/用户'并提供以下数据
{
"realm": "",
"username": "myname",
"credentials": "secret",
"challenges": [],
"email": "scooby@do.com",
"emailVerified": false,
"verificationToken": "",
"status": "",
"created": "",
"lastUpdated": "",
"id": 0
}
回复是
{
"error": {
"name": "ValidationError",
"status": 422,
"message": "The `User` instance is not valid. Details: `password` can't be blank (value: undefined).",
"statusCode": 422,
"details": {
"context": "User",
"codes": {
"password": [
"presence"
]
},
"messages": {
"password": [
"can't be blank"
]
}
},
"stack": "ValidationError: The `User` instance is not valid. Details: `password` can't be blank (value: undefined).
}
我已尝试使用其他数据值但无法弄清楚如何解决“空白密码”问题。任何人都可以指出我可能会失踪的东西吗? 提前谢谢。
答案 0 :(得分:1)
您需要提供password
密钥(即使它未列出)。执行相同的POST /User
,但在JSON对象中输入以下字段:
{
email: "foo@bar.com",
password: "foobar"
}
这两个具体是必需的。您展示的其他部分都是可选的。