Magento-自定义REST API提供404

Magento-自定义REST API提供404,rest,magento,Rest,Magento,我在线学习了一个教程,介绍了如何为Magento 1.9.2创建自定义REST API端点。然而,在完成oauth进程并获得一个秘密和密钥之后,我总是得到一个404试图调用端点 我认为我的问题来自api.xml文件,因为我不太了解可用于各种选项的值。文件如下: <config> <api2> <resource_groups> <categories translate="title" module="EG

我在线学习了一个教程,介绍了如何为Magento 1.9.2创建自定义REST API端点。然而,在完成oauth进程并获得一个秘密和密钥之后,我总是得到一个404试图调用端点

我认为我的问题来自api.xml文件,因为我不太了解可用于各种选项的值。文件如下:

<config>
    <api2>
        <resource_groups>
            <categories translate="title" module="EG_Categories">
                <title>Categories API</title>
                <sort_order>10</sort_order>
            </categories>
        </resource_groups>
        <resources>
            <categories translate="title" module="EG_Categories">
                <group>categories</group>
                <model>categories/api2_categoriesapi</model>
                <title>Category API</title>
                <sort_order>10</sort_order>
                <privileges>
                    <admin>
                        <create>1</create>
                        <retrieve>1</retrieve>
                    </admin>
            <guest>
            <retrieve>1</retrieve>
            </guest>
                </privileges>
                <attributes>
                    <name>Category Name</name>
                    <parent>Parent ID</parent>
                </attributes>
                <routes>
                    <route>
                        <route>/categories/retrieve</route>
                        <action_type>collection</action_type>
                    </route>
                </routes>
                <versions>1</versions>
            </categories>
        </resources>
    </api2>
</config>

类别API
10
类别
类别/api2\u类别API
类别API
10
1.
1.
1.
类别名称
父ID
/分类/检索
收集
1.
特别是,我无法确定collection是否是激活类文件中的_retrieveCollection方法的操作类型的正确值

我有一个类文件位于app/code/local/EG/Categories/Model/Api2/Categories.php。 APi2中还有/Categories/Rest/Admin/V1.php


任何建议都将不胜感激。

您使用的是什么请求URL?您将API类命名为什么,它们的文件夹位置是什么?你清除了你的缓存了吗?是否为此资源分配了正确的API ACL和属性权限?请求URL为API/rest/categories/retrieve。缓存已关闭。我在上面添加的API类。您使用的是什么请求URL?您将API类命名为什么,它们的文件夹位置是什么?你清除了你的缓存了吗?是否为此资源分配了正确的API ACL和属性权限?请求URL为API/rest/categories/retrieve。缓存已关闭。我在上面添加的API类。