cancel
Showing results for 
Search instead for 
Did you mean: 

GETing products REST API unconsistent extension_attributes results

0 Kudos

GETing products REST API unconsistent extension_attributes results

Feature request from jpdata, posted on GitHub Jun 17, 2016

Steps to reproduce

  1. Install Magento 2.0.7 with Sample Data
  2. Get all products with REST API for example GET /rest/V1/products?searchCriteria=

Expected result

  1. All products and every pruct with a produc_links array and every product_link with a extension_attributes array .

Actual result

  1. All products and every pruct with a produc_links array and every product_link with a extension_attributes but for some products it returns an array even empty [] for others with one element does return the single element (not in an array). It should return an array allways, regarding the number of elements returned.

Some time it returns: "extension_attributes":[] some times returns: "extension_attributes":{"qty":0}

As I said it should allways return an array:

"extension_attributes":[{"qty":0}]

3 Comments
apiuser
New Member

Comment from choukalos, posted on GitHub Jun 20, 2016

Hi @jpdata this is a feature request. Current behavior of Magento relies on an extensible object to be plugged into a method. We plug in the extensible objects for the detailed single object calls. For GetList we do not do this as there would be a significant performance issue (system would have to loop through each object and call every extensible object for the current framework resulting in a large # of database calls).

apiuser
New Member

Comment from jpdata, posted on GitHub Jun 20, 2016

I'm developing an app in C# and i'm trying to deserialize Json objets returned to a class generic as I could build it, but it fails since the deserialization utility i'm using (Json.NET) expects and array but there is a single objetct instead. Now I need to find a work around. :-P

Thank you very much.

apiuser
New Member

Comment from choukalos, posted on GitHub Jun 22, 2016

Assigning to Mark to discussion with team.