Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6148563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:18:13+00:00 2026-05-23T19:18:13+00:00

I’m looking for a working example of a Magento API-enabled module. How can I

  • 0

I’m looking for a working example of a Magento API-enabled module. How can I define it, write the code for it, and call it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:18:14+00:00Added an answer on May 23, 2026 at 7:18 pm

    A working config (in app/code/local/ModuleName/etc/ . I wrote mine into api.xml):

    <?xml version="1.0" encoding="UTF-8"?>
    <config>
        <modules>
            <ModuleName>
                <version>0.1.0</version>
            </ModuleName>
        </modules>
        <api>
            <resources>
                <customer translate="title" module="xyz">
                    <model>ModuleName_Model_Api</model>
                    <title>Customer Resource</title>
                    <acl>customer</acl>
                    <methods>
                        <info translate="title" module="xyz">
                            <title>Retrieve customer data</title>
                            <acl>customer/info</acl>
                            <method>info</method>
                        </info>
                    </methods>
                    <faults module="xyz">                   
                    </faults>
                </customer>
            </resources>
            <acl>
                <resources>
                    <customer translate="title" module="xyz">
                        <title>Customers</title>
                        <info translate="title" module="xyz">
                            <title>Get Info Test</title>
                        </info>
                    </customer>
                    <all>
                    </all>
                </resources>
            </acl>
        </api>
    </config>
    

    The PHP code (in app/code/local/ModuleName/Model/Api.php):

    class ModuleName_Model_Api extends Mage_Api_Model_Resource_Abstract
    {
        function info()
        {
            return 'xxx';
        }
    }
    

    The PHP code to actually call the SOAP interface:

    $mageUrl    = 'http:/local.magecomm/api/?wsdl'; 
    $mageUser   = 'soaptest'; 
    $mageApiKey = 'apitest'; 
    
    $soap = new SoapClient($mageUrl); 
    
    $sessionID = $soap->login($mageUser, $mageApiKey);
    
    var_dump($soap->call($sessionID, 'customer.info', array()));
    

    The result of running said script:

    C:/Temp>php magesoap.php
    string(3) "xxx"
    

    Some notes:

    o Error: “Invalid api path.”

    • This means that Magento can’t find the module.

    o Error: “Resource path is not callable.”

    • This means that Magento can’t call the method in the module.

    • You can use the system.log file to debug this. It will display one or more errors about how it couldn’t autoload the requested class from the calculated file-path.

      2011-04-13T15:15:24+00:00 DEBUG (7): include(Mage/Customer/Model/Api.php) [function.include]: failed to open stream: No such file or directoryC:/Development/Projects/MagentoCommercial/lib/Varien/Autoload.php

      2011-04-13T15:15:24+00:00 DEBUG (7): include() [function.include]: Failed opening ‘Mage/Customer/Model/Api.php’ for inclusion (include_path=’C:/Development/Projects/MagentoCommercial/app/code/local;C:/Development/Projects/MagentoCommercial/app/code/community;C:/Development/Projects/MagentoCommercial/app/code/core;C:/Development/Projects/MagentoCommercial/lib;.;C:/Development/Libraries;C:/Development/Libraries/Standard/_Pear’)C:/Development/Projects/MagentoCommercial/lib/Varien/Autoload.php

    o The module-config XML above will link this SOAP interface to a new item in the API permissions called “Get Info Test” under the “Customers” group. It will then be available to allow or deny on specific API users/roles.

    o The value under /config/api/resources/customer/methods/info in the module-config XML is the internal method name of the method that should be bound to the SOAP resource-name. If they’re the same, then you may omit this.

    o The value under /config/api/resources/customer (which is ‘ModuleName_Model_Api’) is the full class-name here because it’s obviously referring to my class, which isn’t part of Mage. If you’re trying to call an existing class within Mage, you can just use the shorthand notation (xxx/yyy, xxx/yyy_zzz, etc..).

    o It’s only in the ACL part of the module-config that the value of the “module” attributes (<… module=””>) seems to matter. All the same, make sure it’s set properly (case doesn’t matter) everywhere. It might be that they just haven’t implemented it mainstream, yet, and to ignore it will just cause you problems later.

    Dustin Oprea

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
i got an object with contents of html markup in it, for example: string
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.