AES Encryption Explained: How It Works and Why It Matters
Jun 23, 2026
2xx Success
The 201 (Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created. The primary resource created is identified by a Location header in the response. This is typically used in RESTful APIs for POST and PUT requests that create new resources.
After a client sends a POST request to create a new user, respond with 201 Created and a Location header containing the new user's URL. The response body should include the created resource representation so the client does not need to make an additional GET request.
// Laravel - returning 201 Created
return response()->json($user, 201, [
'Location' => route('users.show', $user),
]);
Mistake: Returning 201 without a Location header
Fix: Always include a Location header with the URL of the newly created resource. This allows clients to cache and reference the resource without parsing the response body.
Mistake: Using 201 for operations that do not create new resources
Fix: Reserve 201 strictly for resource creation. For updates, use 200 OK. For successful operations that return no content, use 204 No Content.
Blog
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026