By Alvin Alexander. Last updated: April 14, 2018
When you’re writing Play Framework controller actions, you’re typically going to be returning a Play Results
, with the most common result being Ok
. However, your controller actions can return many different result types. This table shows some of the most common result types that you can use instead of Ok
:
Accepted 202 BadGateway 502 BadRequest 400 Conflict 409 Created 201 EntityTooLarge 413 Forbidden 403 Found 302 GatewayTimeout 504 Gone 410 InternalServerError 500 Locked 423 MethodNotAllowed 405 MovedPermanently 301 NotAcceptable 406 NotFound 404 NotImplemented 501 NotModified 304 Ok 200 Redirect RequestTimeout 408 ServiceUnavailable 503 Status(code: Int) specify your own status code TemporaryRedirect 307 TooManyRequest 429 Unauthorized 401
You can see a full list of Results
types at this URL:
And you can read more about Play actions at this URL:
Note that those URLs are for the Play Framework version 2.6.
You can also see the possible result types in your IDE by creating an instance of play.api.mvc.Results and then using your IDE’s code-assist feature.