Magento Enterprise 1.12 - Accessing customer custom attributes from the V2 API

Magento Enterprise 1.12 - Accessing customer custom attributes from the V2 API

October 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Enterprise 1.12 - Accessing customer custom attributes from the V2 API

Exposing Custom Customer Attributes in Magento Enterprise 1.12 V2 API

Hello, developers! Today we’re going to dive into a common Magento challenge: accessing custom customer attributes using the V2 API in Magento Enterprise Edition 1.12.

The Challenge

Our friend Greg here is facing a sticky situation. He’s successfully manipulating system-defined customer attributes like firstname and lastname via both the V1 and V2 APIs. However, his Magento site has custom attribute fields linked to an external CRM that aren’t visible through the V2 API. Since he’s working with a .NET caller that requires the V2 endpoint, this is a real roadblock.

Why Custom Attributes Aren’t Visible

Let’s first understand why these attributes are getting dropped during API response generation. The Magento 1.x series has a specific architecture for exposing data via web services.

In V2, when the customer service is called to retrieve or update customer information, it goes through the following flow:

  1. The service loads the customer data from the database.
  2. It gathers all attribute data for that customer, including both system and custom attributes.
  3. Before generating the XML response in WSDL format, a filter step removes all non-system attributes.

This final step is where our custom fields vanish without a trace!

Debugging the Data Flow

Greg has already done some excellent sleuthing using a debugger to trace the data flow. He’s found that:

  • The V2 API code retrieves all customer attribute data.
  • All non-system (i.e., custom) attributes are subsequently removed before the response is generated.

Why Modifying WSDL and WSI Files Doesn’t Work

Greg tried a clever approach by modifying the Customer WSDL and WSI files to include his custom attributes. While this would work for the V1 API, it doesn’t affect the V2 API’s behavior.

The reason lies in how Magento processes these configuration files:

  • The V1 API uses the WSDL definition directly.
  • In contrast, the V2 API generates its own WSDL file dynamically at runtime based on a predefined template and available data. It doesn’t rely on the static WSDL definitions found in app/code/core/Mage/Customer/etc/wsi.xml or wsdl.xml.

The Solution: Override the Response Builder

Since we can’t modify the API core files (and even if we could, Magento EE 1.12 is already out of support), let’s look at a safer approach.

The key to exposing custom attributes in the V2 API response is to override the XML response generation process. We’ll create a new model that extends Mage_Api_Model_Server_Handler_Customer and redefine the response generation method.

Here’s a high-level overview of what we need to do:

  1. Create a local copy of app/code/core/Mage/Api/Model/Server/Handler/Customer.php.
  2. In your custom module, extend this file as Mage_Api_Model_Server_Handler_CustomCustomer in a new file located at app/code/local/YOUR_COMPANY_NAME/CustomCustomer/etc/api/resources/customcustomer.xml.
  3. Override the generateResponse method to include the custom attributes in the XML response.
  4. Register your new handler resource in customcustomer.xml.

I’ll dive into the exact code implementation and configuration steps in an upcoming post, so stay tuned!

Conclusion

Exposing custom customer attributes via Magento’s V2 API requires a deep understanding of the core API architecture. By overriding the response generation process, we can safely expose these critical data points without modifying core files.

Remember, this solution is specific to certain versions and configurations. Always ensure you have a backup before making changes to your production environment.

For more in-depth tutorials on Magento development best practices, be sure to check out our blog at Laravel Company. We’ll cover advanced topics like API customization, extension development, and performance optimization.

Until next time—keep coding! 🚀💻

Magento 1 Database API Customers

Our network