cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Returning JSON with Web Services

0 Kudos
1,481

If I were to hit this end point with the platformwebservices brought into my project it returns XML. Is there a parameter I can pass that would allow this to return JSON?

http://localhost:9001/ws410/rest/countries

I'm on hybris 6.1 if that matters too.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Pass application/json as required accept type

0 Kudos

I tried passing that as the content type and im still getting XML back

Former Member
0 Kudos

Sorry, not content type but Accept header

Answers (1)

Answers (1)

Former Member
0 Kudos

@RequestMapping(value = "/rest/countries", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })

Former Member
0 Kudos

include in your request mapping.

0 Kudos

But isn't that request mapping in hybris OOTB code? Are you suggesting to override where ever (platformwebservices) this method is to my own custom stuff? So I would have to override the whole extension to get all the endpoints available in JSON?