I have a dropwizard REST API which provides responses in either JSON format or XML format. Right now the client can specify which type of response he needs by specifying it in Accept
header field. I have seen some URLs which specify the type in the URL itself like below
www.example.com/foo.json?id=1
will give response in JSON format
and
www.example.com/foo.xml?id=1
will return response in XML format
How can i do this without two different API endpoints?