i am trying to create a custom REST API
i use this guide https://inchoo.net/magento/configure-magento-rest-and-oauth-settings/
api2.xml file
<?xml version="1.0"?>
<config>
<api2>
<resource_groups>
<lovatapi_restapi translate="title" module="LovatApi_Restapi">
<title>Lovat Api</title>
<sort_order>10</sort_order>
</lovatapi_restapi>
</resource_groups>
<resources>
<lovatapi_restapi translate="title" module="LovatApi_Restapi">
<group>lovatapi_restapi</group>
<model>lovatapi_restapi/api2_restapi</model>
<title>Lovat API</title>
<sort_order>10</sort_order>
<privileges>
<admin>
<create>1</create>
</admin>
</privileges>
<attributes translate="" module="LovatApi_Restapi">
<from>from</from>
<to>to</to>
<p>p</p>
</attributes>
<routes>
<route_collection>
<route>/lovatapi</route>
<action_type>collection</action_type>
</route_collection>
</routes>
<versions>1</versions>
</lovatapi_restapi>
</resources>
</api2>
</config>
but when i try to do request to my api i get this
How to solve this problem?
1 Answer 1
I would suggest to follow that guide. It's pretty detailed and simple: https://code.tutsplus.com/tutorials/create-a-custom-api-in-magento-part-two--cms-23821. You should make it work with that tutorial.
In general I think that your API Wsdl URL is wrong. It should be something like "http://yourmagentostore/api/v2_soap?wsdl=1".
Aditionally the main custom Api files should be "api.xml" for declaring the API methods and the "wsdl.xml" for defining the API methods in SOAP syntax.
Further i'm missing the ACL node inside your provided config. It's used to provide access to the specific ressources.
With the linked tutorial you should be able to make it work.
Good luck