cancel
Showing results for 
Search instead for 
Did you mean: 

How to show all the language values for an attribute in JSON using REST Call?

Former Member
0 Kudos

Hi,

I am using REST API (v2) to get details of a product like below

https://localhost:9002/cpqintegrationservices/v2/electronics/products/3470545.

I am getting a JSON output in the response body of the web service. By default it shows only English language for name and Description attributes.

I need to show all the language values for name and Description attributes. How to do this.

Thanks,

Vinod.

former_member620692
Active Contributor
0 Kudos

Hi - The call can contain additional URL parameters that change the localization of the returned objects and one of the parameters is lang. Please check https://help.hybris.com/1808/hcd/8b718fba8669101486bb9b02be7b9a7e.html for more information and examples.

Former Member
0 Kudos

Hi Arvind,

Thanks for your help. I could get the specified values for the attributes when I give language as query parameter. But could not get all the language values for the attributes when I give like below

https://localhost:9002/cpqintegrationservices/v2/electronics/products/280916?lang=ja〈=en. Here I am getting only Japanese language values.

I need one more help. In the same way I need to create product using JSON with Custom Web Service method https://localhost:9002/cpqintegrationservices/v2/electronics/products/**createProduct**.

How to pass all the language attribute values for that, like { "code": "6666852", name: { "en": "Name", "ja":"カメラ"} }

thanks, Vinod

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vinod,

In OCC response, it will always give you the response in session language. If you are getting it in english, it means your session language is english. If you want to get the value in all the languages then you have to make your ProductData to save all the language values and will be populated by custom logic in product populator. the same thing has to be done in ProductDTO so that datamapper can map the values in ProductDTO which will come as a response.

Let me know if you have any doubt. Give thumps up if it works

Thanks Hamid