Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between HttpStatus.OK and HttpStatus.ACCEPTED

Tags:

rest

spring

api

I am about to implement a REST api. I want to know what's the difference between HttpStatus.OK and HttpStatus.ACCEPTED:

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

And

return new ResponseEntity<User>(u, HttpStatus.ACCEPTED);
like image 509
Cheps Avatar asked May 07 '15 15:05

Cheps


1 Answers

As per Spring documentation given on this link

HttpStatus.OK

200 Ok means The request has succeeded. The information returned with the response is dependent on the method used in the request

HttpStatus.ACCEPTED:

202 Accepted. means The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

for More information on HTTP response Status Code Definitions please visit this link

like image 61
Dev Avatar answered Sep 17 '22 16:09

Dev