我正在用Rest为magento2创建一个应用程序。我面临以下问题。
我可以通过REST创建用户
auth Berear token : bbiotqwwj04prtja2oum5gvfsqt8dnjh
API : Register
URL : http://demo-acm-2.bird.eu/rest/all/V1/customers
method : POST
Request Body
{
"customer": {
"email": "pradeep123@gmail.com",
"firstname": "Abc",
"lastname": "Xyz",
"storeId": 1
},
"password": "Qwe@123123"
}
Response
{
"id": 3,
"group_id": 1,
"created_at": "2020-04-18 12:30:40",
"updated_at": "2020-04-18 12:30:40",
"created_in": "Default Store View",
"email": "pradeep123@gmail.com",
"firstname": "Abc",
"lastname": "Xyz",
"store_id": 1,
"website_id": 1,
"addresses": [],
"disable_auto_group_change": 0,
"extension_attributes": {
"is_subscribed": false
}
}但是,当我尝试与同一个用户登录以获得令牌时,它会给我一条类似错误的消息。在magento2中是否有其他方法可以使用rest获取用户令牌/登录?
API: Login
URL: http://demo-acm-2.bird.eu/rest/all/V1/integration/customer/token
method : POST
Request Body
{
"username" : "pradeep123@gmail.com",
"password" : "Qwe@123123"
}
Response
{
"message": "You did not sign in correctly or your account is temporarily disabled."
}发布于 2020-08-29 12:17:42
客户注册API
API名称:客户注册API
描述:创建客户帐户。执行必要的业务操作,如发送电子邮件。
baseurl:{rest URL}/rest/V1/customers
方法: POST
Body:
{
"customer": {
"email": "testtest123@gmail.com",
"firstname": "Kavin",
"lastname": "Peter",
"addresses": [{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "Kavin",
"lastname": "Peter",
"region": {
"regionCode": "NY",
"region": "New York",
"regionId":43
},
"postcode": "10755",
"street": ["123 Oak Ave"],
"city": "Purchase",
"telephone": "1234567890",
"countryId": "US"
}],
"extension_attributes": {
"is_subscribed": true
},
"custom_attributes": [
{
"attribute_code": "customer_mobile",
"value": "1234567890"
}
]
},
"password": "test123"
}响应:
{
"id": 55,
"group_id": 1,
"default_billing": "32",
"default_shipping": "32",
"created_at": "2020-08-29 12:10:14",
"updated_at": "2020-08-29 12:10:31",
"created_in": "Default Store View",
"email": "testtest123@gmail.com",
"firstname": "Kavin",
"lastname": "Peter",
"store_id": 1,
"website_id": 1,
"addresses": [
{
"id": 32,
"customer_id": 55,
"region": {
"region_code": "NY",
"region": "New York",
"region_id": 43
},
"region_id": 43,
"country_id": "US",
"street": [
"123 Oak Ave"
],
"telephone": "1234567890",
"postcode": "10755",
"city": "Purchase",
"firstname": "Kavin",
"lastname": "Peter",
"default_shipping": true,
"default_billing": true
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"is_subscribed": true
},
"custom_attributes": [
{
"attribute_code": "customer_mobile",
"value": "1234567890"
}
]
}登录API
API名称:登录API
Description:为客户凭据创建访问令牌。
baseurl:{rest URL}/rest/V1/integration/customer/token
方法: POST
Body:
{
"username": "kirti.nariya@magedelight.com",
"password": "test@$123"
}响应:
"bdw1x6cb3ntbdj6d4pqfzr8xksjezkv2"https://stackoverflow.com/questions/61289394
复制相似问题