Magento – Custom REST API – resource not found

apimagento-1.9rest

I have followed the tutorial and making a simple REST API.

api2.xml FILE

<?xml version="1.0"?>
<config>
    <api2>
        <resource_groups>
            <custac translate="title" module="sharan">
                <group>sharan</group>
                <title>Abandoned Cart</title>
                <sort_order>10</sort_order>
            </custac>
        </resource_groups>

        <resources>
            <custac translate="title" module="sharan">
                <group>custac</group>
                <model>sharan/api2_restapi</model>
                <title>Abandoned cart info</title>
                <sort_order>2</sort_order>
                <privileges>
                    <admin>
                        <create>1</create>
                        <retrieve>1</retrieve>
                        <delete>1</delete>
                    </admin>                   
                </privileges>
                <routes>
                    <route>
                        <route>abcart</route>
                        <action_type>entity</action_type>
                    </route>
                </routes>
                <versions>1</versions>
            </custac>
        </resources>
    </api2>
</config>

Model file – Api2_Restapi

<?php 
class Ziffity_Sharan_Model_Api2_Restapi extends Mage_Api2_Model_Resource{
    public function _retrieve(){
        return json_encode(array("value"=>"Hello World"));
    }
}///end of class//
?>

V1.php file

<?php
class Ziffity_Sharan_Model_Api2_Rest_V1 extends Ziffity_Sharan_Model_Api2_Restapi{
    public  function _retrieve(){
        return json_encode(array("value"=>"Hello World"));
    }
} 
?>

Best Answer

SOLUTION FOUND

My Folder Structure was wrong.

SHOULD BE EXACTLY LIKE BELOW TO WORK

enter image description here

The Rest Folder should have Role Type Folders inside and then the V1.php files with the respective class names.