i am using
magento 2.1.1
php version 7.0
this is my payload and response.
i want to add customer token in the response and i am using following magento 2 api :
http://host/index.php/rest/default/V1/customers
Example (*)
in the response i want to add seesion id in following response :
{
"id": 2278,
"group_id": 1,
"created_at": "2018-11-13 14:06:24",
"updated_at": "2018-11-13 14:06:24",
"created_in": "Default Store View",
"email": "test1023@gmail.com",
"firstname": "test",
"lastname": "lastName",
"store_id": 1,
"website_id": 1,
"addresses": [],
"disable_auto_group_change": 0
"session_id": "b5la2wrgxx00oqu83yuvqdthnqjv1tmv"
}
Hope you guys understand my problem
Best Answer
Create a afterCreateAccount plugin of AccountManagementInterface. You need to create a new customer attribute as well. Your plugin code will look like below.
di.xml
extension_attributes.xml
Go into module.xml file and update setup_version to 1.0.1 and run setup:upgrade command. Let me know if any more help needed.