Justen Martin
Justen Martin

Reputation: 656

Creating custom magento webservices

I'm having some trouble creating some custom web services in Magento. I'm trying to get the module configured properly and I can't seem to make the web services I've defined in the api.xml file show up under the user role setup in the admin area.

I've defined a custom module in app/etc shown here

ctp_GiftCards.xml:

<?xml version="1.0"?>
<config>
<modules>
    <ctp_GiftCards>
        <active>true</active>
        <codePool>local</codePool>
    </ctp_GiftCards>
</modules>
</config>

The module code is located in app/local/ctp/GiftCards/

Here is an example of the etc/api.xml:

<?xml version="1.0"?>
<config>
    <api>
            <resources>
                    <GiftCards translate="title" module="ctp_GiftCards">
                    <title>GiftCard webservices</title>
            <acl>GiftCards/GiftCard</acl>
                    <methods>
                                <update translate="title" module="ctp_GiftCards">
                                        <title>updates a giftcard account</title>
                                </update>       
                        </methods>
            <faults module="ctp_GiftCards">
                <invalid_data>
                <code>100</code>
                <message>giftcard data invalid</message>
                </invalid_data>
                <card_pool_error>
                <code>101</code>
                <message>card pool for entry not updated</message>
                </card_pool_error>
                <cache_error>
                <code>102</code>
                <message>cache not reset</message>
                </cache_error>
            </faults>
                    </GiftCards>
            </resources>
    <acl>
        <resources>
            <GiftCards translate="title" module="ctp_GiftCards">
                <title>GiftCards</title>
                <sort_order>6</sort_order>
                <GiftCard translate="title" module="ctp_GiftCards">
                    <title>GiftCard</title>
                    <update translate="title" module="ctp_GiftCards">
                        <title>Update</title>
                    </update>

                </GiftCard>
            </GiftCards>
        </resources>
    </acl>
    </api>
</config>

and the etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
    <ctp_GiftCards>
        <version>0.1.0</version>
    </ctp_GiftCards>
</modules>
    <global>
            <models>
                    <GiftCard>
                            <class>CTP_GiftCards_Model</class>
                    </GiftCard>
            </models>
    </global>
</config>

Any help would be much appreciated.

--edit-- I'm using mangeto pro 1.10

Upvotes: 0

Views: 1825

Answers (1)

ntuan16
ntuan16

Reputation: 198

Don't use capital letter (GiftCards) in the name of xml tag inside the node. Moreover, your module's name contains both underscope (_) and capital letter (ctp_GiftCards) which will lead Magento to misunderstand.

Upvotes: 1

Related Questions