Mr.DevEng
Mr.DevEng

Reputation: 2421

Rest End point not showing any json data when using POSTMAN application

I am trying to implement sample spring boot project and trying to retrieve result using POSTMAN application. But when using POSTMAN , I am not able to see that response for a GET request. But I can see by using browser properly. POSTMAN returning "Expected ':' instead of 't'" as result. But I can see result properly by using browser.

enter image description here

And my controller code is like the following,

@GetMapping("/check")
    public List<Users> check() {
        return  (List<Users>) userObj.findAll();
    }

Can anyone help me to find out why I am not able to see result using POSTMAN application please?

Upvotes: 0

Views: 10128

Answers (2)

Saurabh Oza
Saurabh Oza

Reputation: 179

You server application needs to understand the incoming request type. can you define the Content-Type=application/json and give a try.

Upvotes: 0

Anunay
Anunay

Reputation: 1893

You are saying to postman (for that matter any client) that your api is producing json and instead you are returning just a string.

Check your header you will have a field called

Content-Type → application/json;charset=UTF-8

All you need to do is ensure you are sending valid json or remove that header entry so clients do not try to read it as json. Or just to check you are getting right data by changing format from json to text in postman

enter image description here

Upvotes: 2

Related Questions