Using \Magento\Customer\Api\Data\CustomerRepository Save method we can create single customer with the attributes in \Magento\Customer\Api\Data\CustomerInterfacewith single API request.
But how can we create multiple customers at a time with single API request.
If i send multiple customers objects in a single request its giving error expecting the \Magento\Customer\Api\Data\CustomerInterface attributes.
So how can i create API with \Magento\Customer\Api\Data\CustomerRepository Save method with array of \Magento\Customer\Api\Data\CustomerInterface attributes
1 Answer 1
You have 2 option.
- Send many request
- Create service that gets list of customers and save it use Customer Repository
-
When i use first option its giving error, expecting
\Magento\Customer\Api\Data\CustomerInterfaceattributes. For second option please provide example which worksprasad maganti– prasad maganti2015年10月06日 11:56:57 +00:00Commented Oct 6, 2015 at 11:56 -
what is the importance of KEY keyword in api, example github.com/magento/magento2/blob/develop/app/code/Magento/… compared to other attributes which do not have KEY keywordprasad maganti– prasad maganti2015年10月06日 12:25:18 +00:00Commented Oct 6, 2015 at 12:25
-
gist.github.com/kandy/dd6592508c5774d9235dKAndy– KAndy2015年10月06日 12:38:53 +00:00Commented Oct 6, 2015 at 12:38
-
you are calling customer request api each time for the each customer, but i want to send multiple customers in a single requestprasad maganti– prasad maganti2015年10月07日 07:11:43 +00:00Commented Oct 7, 2015 at 7:11
-
Magento 2 don't have this possibility, but you create simple module for thisKAndy– KAndy2015年10月07日 08:02:33 +00:00Commented Oct 7, 2015 at 8:02