How to get value of core_config_data eg. general/region/state_required using Magento soap api?

2 Answers 2


Create A Custommodule:

Api File(Api.php)

class Amit_Customapi_Model_Api extends Mage_Api_Model_Resource_Abstract
        public function myregion()
             $countryList = explode(',', Mage::getStoreConfig(general/region/state_required));

        return $countryList;

and etc/api.xml is

<?xml version="1.0"?>
            <customapi_api translate="title" module="customapi">
                        <myregion translate="title" module="customapi">
                            <title>Require Region</title>
                <customapi translate="title" module="customapi">
                    <myregion translate="title" module="customapi">
                        <title>Require Region</title>

You can access by below url


$client = new SoapClient('http://yourhost/api/soap/?wsdl');
$session = $client->login('******', '******');
$date = $client->call($session, 'customapi_api.myregion');


$client = new Zend_XmlRpc_Client('http://yourhost/api/xmlrpc/');
$session = $client->call('login', array('******', '******'));
$date=$client->call('call', array($session, 'customapi_api.myregion'));

Edit: Full module

File:config.xml and 

code of this file:

<?xml version="1.0"?>
  • Thanks Amit for such a detailed answer. I tried creating custom module as you mention (Also added blank Helper/Data.php and assign role 'Required Region' to user ) but it says 'Access Denied'. I don't know what went wrong
    – Sandesh
    Aug 22, 2014 at 10:30
  • I need to create helper class.then reset admin permissio
    – Amit Bera
    Aug 22, 2014 at 10:52
  • What I did is created Helper/Data.php with <?php class Amit_Customapi_Helper_Data extends Mage_Core_Helper_Abstract { } But still it says 'Access Denied'. What do you mean by 'RESET admin permisssion'
    – Sandesh
    Aug 22, 2014 at 10:59
  • If Webservice - SOAP - Resource Roles selected to All then output is correct, but if Resource role selected to Custom and checked Required Region then output is Access Denied. Any Idea how to fix this?
    – Sandesh
    Aug 22, 2014 at 12:37
  • @AmitBera My soap return value as objects how to return as XML? my code : justpaste.it/58dm2 can you pls help me?
    – zus
    Nov 15, 2018 at 4:41

You can't.

But what you can do is create your own SOAP API callable function/extend SOAP API.

The (current) details are published here: http://www.magentocommerce.com/api/soap/create_your_own_api.html

Then you can make Magento do what you need.

There may be a module out there already that exposes parts if not the whole of core_config_data but it's unlikely!

The Core Config Data is a odd one to expose on the API as it contains most of the keys to the empire. So if you do extend to get data from here, make sure it's read only and restrict it to a set of keys. Say general/region/*

Not the answer you're looking for? Browse other questions tagged or ask your own question.