Magento V2 API in C# – Where’s my attributes?

So you’ve figured out how to pull a list of products from Magento, but you don’t see any of your custom attributes. The problem: You’ve got to ask for them.

First, get a list of the attributes you’ve defined. The list you get from here can be cut and pasted into your code.

MagentoListOfAttributes

Here’s the code that pulls products AND requested attributes.

MagentoService client = new MagentoService();
sessionID = client.login(…);

//filters… see Magento V2 API Filters in C# – Simple Example
catalogProductEntity[] productList = client.catalogProductList(sessionID, filters, null);

catalogProductRequestAttributes attributes =
new catalogProductRequestAttributes()
{
additional_attributes = new string[] {
“attribute_1”
,”attribute_2″
,”attribute_3″
.
.
.
};

foreach (catalogProductEntity entity in productList)
{
catalogProductReturnEntity productInfo = client.catalogProductInfo(sessionID, entity.product_id, null, attributes, null);
}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s