cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Rest API Documentation Discrepency

Magento 2 Rest API Documentation Discrepency

According to the Swagger documentation, the variable names in the name/value pair REST JSON responses are camel case:

http://devdocs.magento.com/swagger/index_20.html#/

 

I have a 2.0.10 installation and the swagger documentation looks the same as the link above.

 

When I make an actual REST API call, the keys in the json file are not camel cased, but underscore separated values. For example, the documentation says the response to /V1/orders/items has a field called "baseDiscountAmount."  When I make the actual call, it returns base_discount_amount.

 

In Magento 2.1, both the documentation and the response conform to the underscore format. 

 

My question is this: Is there a version of Magento where, when making a REST call, magento will return results that are camel case? If so, what version did this change? 

 

Thanks,

Kevin

Tags (1)
3 REPLIES

Re: Magento 2 Rest API Documentation Discrepency

Hi,

 

do you have any updates on this issue. I also was wondering why my REST client didn't work until i figured it out that the format is camel case on my Magento 2.1 instance.

 

The online documentation still shows camelCased properties: http://devdocs.magento.com/swagger/index_20.html#/

Re: Magento 2 Rest API Documentation Discrepency

@Robar_666, Which REST API are you trying from devdocs swagger?

I have worked in so much api from swagger and its all by using underscore by word. So dont hesitate to use underscore for properties of api format.

 

Let me know if you still issue.

Thanks.

 

If Issue Solved, Click Kudos/Accept As solutions.

Re: Magento 2 Rest API Documentation Discrepency

I've a locally installed Magento 2.1 and a remote magento installation with the version 2.0. both returning the underscored properties.

 

The online documentation of Magento (link above) states that those properties should be camel cased. 

 

But after some further searching I found out that the problem is alread acknowledged: https://github.com/magento/magento2/issues/2310