Difference between HttpStatus.OK and HttpStatus.ACCEPTED

I am going to implement REST api. I want to know what is the difference between HttpStatus.OK

and HttpStatus.ACCEPTED

:

return new ResponseEntity<User>(u, HttpStatus.OK));

      

and

return new ResponseEntity<User>(u, HttpStatus.ACCEPTED);

      

+3


source to share


1 answer


As per the Spring documentation given at this link

HttpStatus.OK

200 Ok means the request was successful. The information returned with the response depends on the method used in the request

HttpStatus.ACCEPTED:

202 Accepted. means that the request has been accepted for processing, but processing has not yet been completed. The request may or may not be subsequently applied as it may be prohibited when processing actually takes place.



for more information on HTTP response code definitions please visit the link

+9


source







All Articles