I'm trying to create a customer using the Magento REST API.
I can use my token to retrieve/update data just fine, but for whatever reason I am unable to create an account, regardless of the permissions I set ("All" or "Custom with checked boxes").
Here is a screenshot of the Magento admin, if you notice, for whatever reason, Customers does not have a Create option and I cannot figure out why that is either, and may ultimately be why I am unable to use the POST /api/rest/customers call as outlined in the Magento documentation.
screenshot of the Magento admin
Any advice would be greatly appreciated. Thank you!
2 Answers 2
The reason the Create permission is missing is that it's not in the api2.xml file for the Mage_Customers module. The _create method that is needed is also missing.
You can add the following to a custom module's api2.xml file to add the missing create permission.
<config>
<api2>
<resources>
<customer>
<privileges>
<admin>
<create>1</create>
</admin>
</privileges>
</customer>
</resources>
</api2>
</config>
You'll also need to add the missing _create method by extending the Mage_Customer_Model_Api2_Customer_Rest_Admin_V1 class.
-
If i try to get customer list using REST API i am getting error -> screenshot -> snag.gy/3PSxvm.jpg -> URL -> 127.0.0.1/anusthana/api/rest/customers. and if i try to get products its working -> screenshot -> snag.gy/sePpyw.jpg -> url 127.0.0.1/anusthana/api/rest/products, can i get help regard customer API error? @Siarhey Uchukhlebauzus– zus2018年10月24日 08:41:45 +00:00Commented Oct 24, 2018 at 8:41
While developing a website we found that many "write" operations for REST APIs were not working very well. Our general solution was to use SOAP for writes and REST for reads, as REST is slightly faster than SOAP.
Explore related questions
See similar questions with these tags.