休息Api Magento请求与任何路线都不匹配

时间:2015-02-27 03:14:56

标签: rest magento

这是我在Magento上的xml文件

<config>
    <api2>
        <resource_groups>
            <extendrestapi translate="title" module="api2">
                <title>Extended Rest API</title>
                <sort_order>10</sort_order>
            </extendrestapi>
        </resource_groups>
        <resources>
            <extendrestapicategory translate="title" module="api2">
                <group>extendrestapi</group>
                <model>extendrestapi/api2_category</model>
                <title>Categories</title>
                <sort_order>10</sort_order>
                <privileges>
                    <admin>
                        <retrieve>1</retrieve>
                    </admin>
                    <guest>
                        <retrieve>1</retrieve>
                    </guest>
                </privileges>
                <attributes>
                    <entity_id>Category ID</entity_id>
                    <name>Name</name>
                    <parent_id>Category Parent ID</parent_id>
                    <is_active>Active</is_active>
                    <level>Level</level>
                    <position>Position</position>
                    <children>Children Ids</children>
                    <url_key>URL key</url_key>
                    <store_id>Store ID</store_id>
                </attributes>
                <routes>
                    <route_entity>
                        <route>/ikom/categories/:id</route>
                        <action_type>collection</action_type>
                    </route_entity>
                    <route_collection>
                        <route>/ikom/categories</route>
                        <action_type>collection</action_type>
                    </route_collection>
                </routes>
                <versions>1</versions>
            </extendrestapicategory>
            <extendrestapiproductattribute translate="title" module="api2">
                <group>extendrestapi</group>
                <model>extendrestapi/api2_productattribute</model>
                <title>Product Attributes</title>
                <sort_order>10</sort_order>
                <privileges>
                    <admin>
                        <retrieve>1</retrieve>
                    </admin>
                    <guest>
                        <retrieve>1</retrieve>
                    </guest>
                </privileges>
                <attributes>
                    <id>Name</id>
                    <options>Options value/label</options>
                </attributes>
                <routes>
                    <route_entity>
                        <route>/testapi/:id</route>
                        <action_type>collection</action_type>
                    </route_entity>
                    <route_collection>
                        <route>/testapi</route>
                        <action_type>collection</action_type>
                    </route_collection>
                </routes>
                <versions>1</versions>
            </extendrestapiproductattribute>
        </resources>
    </api2>
</config>

我不知道为什么我会运行此网址http://localhost/magento_4/api/rest/ikom/testapi/1,这会有回复{"messages":{"error":[{"code":404,"message":"Request does not match any route."}]}}。 这里有什么问题?

1 个答案:

答案 0 :(得分:0)