Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest API can't able to update customer throws the error. #24625

Closed
kirtinariya1 opened this issue Sep 17, 2019 · 5 comments
Closed

Rest API can't able to update customer throws the error. #24625

kirtinariya1 opened this issue Sep 17, 2019 · 5 comments
Labels
Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@kirtinariya1
Copy link
Contributor

kirtinariya1 commented Sep 17, 2019

Magento 2.3.0 rest API can't able to update customer throws the error.
API /V1/customers/:customerId
Method: PUT
URL: http://localhost/magentosample230/rest/V1/customers/2

Preconditions (*)

  1. Magento 2.3.0 & 2.3-develop

Steps to reproduce (*)

  1. Run the customer update API.
  2. Method: PUT
  3. Headers: Authorization:Bearer yfhwg1j458dw086qelbqkkkmp6f0tj89
    Content-Type:application/json
  4. Body:
{
      "customer": {
      "email": "john@gmail.com",
      "firstname": "firstname new",
      "lastname": "lastname new",
      "website_id": 1
   }
}
  1. URL: http://localhost/magentosample230/rest/V1/customers/2

Expected result (*)

  1. Customer should be updated and reponse will return success message.

Actual result (*)

  1. Throw the error in response.
    Error:
{
    "message": "A customer with the same email address already exists in an associated website.",
    "trace": "#0 /var/www/html/magentosample230/vendor/magento/module-eav/Model/Entity/VersionControl/AbstractEntity.php(90): Magento\\Customer\\Model\\ResourceModel\\Customer->_beforeSave(Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#1 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Eav\\Model\\Entity\\VersionControl\\AbstractEntity->save(Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#2 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor->___callParent('save', Array)\n#3 /var/www/html/magentosample230/vendor/magento/framework/App/Cache/FlushCacheByTags.php(68): Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#4 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(135): Magento\\Framework\\App\\Cache\\FlushCacheByTags->aroundSave(Object(Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor), Object(Closure), Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#5 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#6 /var/www/html/magentosample230/generated/code/Magento/Customer/Model/ResourceModel/Customer/Interceptor.php(117): Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor->___callPlugins('save', Array, NULL)\n#7 /var/www/html/magentosample230/vendor/magento/framework/Model/AbstractModel.php(648): Magento\\Customer\\Model\\ResourceModel\\Customer\\Interceptor->save(Object(Magento\\Customer\\Model\\Customer\\Interceptor))\n#8 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Framework\\Model\\AbstractModel->save()\n#9 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Customer\\Model\\Customer\\Interceptor->___callParent('save', Array)\n#10 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Customer\\Model\\Customer\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#11 /var/www/html/magentosample230/generated/code/Magento/Customer/Model/Customer/Interceptor.php(1118): Magento\\Customer\\Model\\Customer\\Interceptor->___callPlugins('save', Array, Array)\n#12 /var/www/html/magentosample230/vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php(219): Magento\\Customer\\Model\\Customer\\Interceptor->save()\n#13 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository->save(Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#14 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->___callParent('save', Array)\n#15 /var/www/html/magentosample230/vendor/vertex/module-tax/Model/Plugin/CustomerRepositoryPlugin.php(179): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#16 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(135): Vertex\\Tax\\Model\\Plugin\\CustomerRepositoryPlugin->aroundSave(Object(Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor), Object(Closure), Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#17 /var/www/html/magentosample230/vendor/magento/module-customer/Model/Plugin/CustomerRepository/TransactionWrapper.php(44): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#18 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(135): Magento\\Customer\\Model\\Plugin\\CustomerRepository\\TransactionWrapper->aroundSave(Object(Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor), Object(Closure), Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#19 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#20 /var/www/html/magentosample230/generated/code/Magento/Customer/Model/ResourceModel/CustomerRepository/Interceptor.php(26): Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->___callPlugins('save', Array, NULL)\n#21 [internal function]: Magento\\Customer\\Model\\ResourceModel\\CustomerRepository\\Interceptor->save(Object(Magento\\Customer\\Model\\Data\\Customer), NULL)\n#22 /var/www/html/magentosample230/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#23 /var/www/html/magentosample230/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->process(Object(Magento\\Framework\\Webapi\\Rest\\Request\\Proxy))\n#24 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#25 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callParent('dispatch', Array)\n#26 /var/www/html/magentosample230/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#27 /var/www/html/magentosample230/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n#28 /var/www/html/magentosample230/vendor/magento/framework/App/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#29 /var/www/html/magentosample230/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\\Framework\\App\\Http->launch()\n#30 /var/www/html/magentosample230/vendor/magento/framework/App/Bootstrap.php(258): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#31 /var/www/html/magentosample230/index.php(39): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#32 {main}"
}
@m2-assistant
Copy link

m2-assistant bot commented Sep 17, 2019

Hi @kirtinariya1. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@kirtinariya1 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Sep 17, 2019
@engcom-Charlie engcom-Charlie self-assigned this Sep 17, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 17, 2019

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie engcom-Charlie added Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 17, 2019
@ghost ghost unassigned engcom-Charlie Sep 17, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Charlie
Thank you for verifying the issue. Based on the provided information internal tickets MC-20196 were created

Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Sep 17, 2019
@jmcharadva
Copy link

jmcharadva commented Sep 17, 2019

@kirtinariya1
Can you please check with below mentioned parameter?
{
"customer": {
"id":1,
"email": "your@email.com",
"firstname": "firstname new",
"lastname": "lastname new",
"website_id": 1
}
}

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Sep 17, 2019

@jmcharadva thanks for contributing!
image
@kirtinariya1 you have to write customer id in your request body
Swagger:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

4 participants