I am using spring rest to create handle rest api creation in the project . The rest method is annotated with the following.
@GetMapping(value = FETCH_ALL,produces ={MediaType.APPLICATION_XML_VALUE,MediaType.APPLICATION_JSON_VALUE})
I have added the following dependancy to the maven project
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
I am using postman to make test the api and i am passing Content-Type in the header as application/json but it still returns me the xml format.
I am not able to figure out what i have missed in the configuration to return the content the user is requesting for
TIA
You have to specify Accept Header in your request.
Accept: application/json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With