Strongloop 环回。无法从资源管理器添加用户实例
Strongloop loopback. Cannot add User instance from explorer
我创建了一个模型(slc loopback:model 客户),完成 'slc run',然后浏览到 http://localhost:3000/explorer/。我看到 'customer' 和 'User' 模型。但我无法弄清楚如何将实例添加到用户模型。我select'Users->Post /Users'并提供以下数据
{
"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).
}
我已尝试使用其他数据值,但无法弄清楚如何解析 'blank password'。谁能指出我可能遗漏了什么?
提前致谢。
您需要提供 password
密钥(即使未列出)。执行相同的 POST /User
,但在 JSON 对象中输入这些字段:
{
email: "foo@bar.com",
password: "foobar"
}
这两个是特别需要的。您显示的其余部分是可选的。
我创建了一个模型(slc loopback:model 客户),完成 'slc run',然后浏览到 http://localhost:3000/explorer/。我看到 'customer' 和 'User' 模型。但我无法弄清楚如何将实例添加到用户模型。我select'Users->Post /Users'并提供以下数据
{
"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).
}
我已尝试使用其他数据值,但无法弄清楚如何解析 'blank password'。谁能指出我可能遗漏了什么? 提前致谢。
您需要提供 password
密钥(即使未列出)。执行相同的 POST /User
,但在 JSON 对象中输入这些字段:
{
email: "foo@bar.com",
password: "foobar"
}
这两个是特别需要的。您显示的其余部分是可选的。