0

I have this code

code on /app/etc/modules/Custom_Restapi.xml

<?xml version="1.0"?>
<config>
<modules>
    <Custom_Restapi>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            Mage_Api2
        </depends>
    </Custom_Restapi>
</modules>

code on app/code/local/Custom/Restapi/etc/api2.xml

<?xml version="1.0"?>
<config>
<api2>
    <resource_groups>
        <custom_restapi translate="title" module="Custom_Restapi">
            <title>Custom Rest API</title>
            <sort_order>10</sort_order>
        </custom_restapi>
    </resource_groups>
    <resources>
        <custom_restapi translate="title" module="Custom_Restapi">
            <group>custom_restapi</group>
            <model>custom_restapi/api2_restapi</model>
            <title>Testing My Rest API</title>
            <sort_order>10</sort_order>
            <privileges>
                <guest>
                    <create>1</create>
                </guest>
            </privileges>
            <attributes  translate="firstname lastname email password" module="Custom_Restapi">
                <firstname>First Name</firstname>
                <lastname>Last Name</lastname>
                <email>Email</email>
                <password>Password</password>
            </attributes>
            <routes>
                <route_entity>
                    <route>/customer/:id</route>
                    <action_type>entity</action_type>
                </route_entity>
                <route_collection>
                    <route>/customer</route>
                    <action_type>collection</action_type>
                </route_collection>
            </routes>
            <versions>1</versions>
        </custom_restapi>
    </resources>
</api2>

code on code on app/code/local/Custom/Restapi/etc/api2.xml

<config>
<modules>
    <Custom_Restapi>
        <version>0.1.0</version>
    </Custom_Restapi>
</modules>
<global>
    <models>
        <custom_restapi>
            <class>Custom_Restapi_Model</class>
        </custom_restapi>
    </models>
</global>

code on app/code/local/Custom/Restapi/Model/Api2/Restapi/Rest/Guest/V1.php

 class Custom_Restapi_Model_Api2_Restapi_Rest_Guest_V1 extends 
 Custom_Restapi_Model_Api2_Restapi
 {

/**
 * Create a customer
 * @return array
 */

public function _create(array $data) {

    var_dump('tested');
    exit;
}

}

code on app/code/local/Custom/Restapi/Model/Api2/Restapi.php

class Custom_Restapi_Model_Api2_Restapi extends Mage_Api2_Model_Resource
{

}

but i have this error all time

enter image description here

My structure

enter image description here

please tell me how to display my var_dump, why all time 404?

And if I want to add another controller, what do I need to do for this?

and how give permission on this resource in the admin area ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.