201

Created

Official
The new resource was created according to the request

Specification of the HTTP status code 201

The 201 Created status code indicates that the request was fulfilled and resulted in the creation of one or more new resources. The primary resource created by the request is identified either by a location header field in the response or, if no location field is received, by the effective request URI. The payload of the 201 Created response typically describes and references the resource(s) created. See Section 7.2 for a discussion of the meaning and purpose of validator header fields, such as ETag and Last-Modified, in a 201 Created response.

Source / Quote by: The 201 Created HTTP Status Code is specified by section 6.3.2 of RFC7231.

How to throw a 201 statuscode with PHP?

To throw the HTTP status code 201 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(201) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 201 HTTP status code

In order to be able to display the HTTP status code (in this case 201 Created) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 201 Created
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=201
Status: 201 Created
Those: Network
IP address: XX.XX.XX.XX
Status code 201 Created

Browser compatibility of the 201 status code

Chrome Yes
Edge Yes
Firefox Yes
Opera Yes
Safari Yes
Chrome Android Yes
Firefox for Android Yes
Opera Android Yes
Safari on iOS Yes
Internet Yes
WebView Android Yes

Constants in programming languages

http.StatusCreated
Response::HTTP_CREATED
:created

Blog Articles

HTTP status codes 200 OK and 201 Created: successful, but different in meaning

The history of HTTP status codes. The history of HTTP status codes dates back to 1996, when the 200 OK status code came into existence with the introduction of HTTP 1.0. At that time, this code was...

SEO and HTTP status codes: A comprehensive analysis

Optimizing a website for search engines (SEO) is a complex undertaking. One of the often overlooked but crucial aspects for a good ranking are HTTP status codes. These small, three-digit codes info...

Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub