view source
Handling JSON Error Object Responses With Spring's RestTemplate
Some web services return JSON error objects when there’s a problem. GitHub’s API is a good case in point, and HipChat’s API does the same thing. The approach is pretty common. Error objects give the API a way to communicate details beyond what the HTTP status codes indicate. (For more information on how to generate such responses, please see my post Generating JSON Error Object Responses With Spring Web MVC.)
Advertisement