http 419 code example
Example 1: error 418
Error 418 - I'm a teapot was an april fools joke that was made in 1998 & 2014 which was a part of the HTCPCP extension HTCPCP-TEA which was also a part of the april fools joke. Error 418 was eventually gonna get removed but then a movement started named "save 418" saying the internet would be somewhat incomplete without it and it succeded so now error code 418 has become a part of the official web. https://www.google.com/teapot
Example 2: http status codes
2xx : SUCCESS
200 OK : success
201 CREATED : successfully added data
204 NO-CONTENT successfully updated or deleted
3xx : REDIRECTION
304 NOT MODIFIED:
4xx : CLIENT SIDE ERROR
400 BAD REQUEST : bad data being sent
401 UNAUTHORIZED :
403 FORBIDDEN :
404 NOT FOUND : the resource does not exists at that location
405 METHOD NOT ALLOWED :
DELETE /api/spartans -->> 405 error
406 NOT ACCEPTABLE
415 Unsupported Media type
if you forget to specify the Content-Type
of Post request body, it will see it as plain text
and it will throw this error if it does not support
5xx : Server side error
500 internal service error
If the server do not have any mapping of the url
requested to handle the action -->> 500
503 SERVICE UNAVAILABLE :
504 GATEWAY TIMEOUT :
Example 3: HTTP call status: 419
Use this in the head section:
<meta name="csrf-token" content="{{ csrf_token() }}">
and get the csrf token in ajax:
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});