Middle
What is the difference between HTTP codes 200 and 201?
sobes.tech AI
Answer from AI
HTTP status code 200 indicates a successful request, typically used for responses to GET requests when the server returns the requested resource.
HTTP status code 201 indicates that the request was successful and resulted in the creation of a new resource. It is usually used for POST requests when a new object is created on the server.
Example:
- 200 OK — a request to retrieve user data returned the information.
- 201 Created — a request to create a new user was successful, and the user was created.