O'Reilly logo

RESTful Java Patterns and Best Practices by Bhakti Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Response codes and REST patterns

HTTP provides standardized response codes that can be returned for every request. The following table summarizes the REST response patterns based on CRUD API. There are subtle differences based on the operation used as well as whether the content is sent or not as part of the response:

Group

Response code

Description

Success 2XX

200 OK

This can be used for the create, update, or delete operations with PUT, POST, or DELETE. This returns content as part of the response.

 

201 Created

This can be used when creating a resource with PUT. This must contain the Location header of the resource.

 

204 No Content

This can be used for the DELETE, POST, or PUT operation. No content is returned as part of the response. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required