tool::http-status-detail
201 Created
The request has been fulfilled and a new resource has been created.
상태 코드
201
이름
Created
카테고리
2xx상세 설명
HTTP 201 Created는 요청이 성공적으로 처리되어 새 리소스가 생성되었음을 나타냅니다. POST 요청으로 새 사용자, 게시물, 주문 등을 생성할 때 200 대신 사용해야 합니다. Location 헤더에 생성된 리소스의 URL을 포함하는 것이 REST API 모범 사례입니다.
주요 원인
- ▸POST 요청으로 새 데이터베이스 레코드를 생성한 경우
- ▸파일 업로드 성공 후 새 파일 리소스가 생성된 경우
- ▸회원가입, 게시글 작성, 주문 생성 등 새 항목 추가 작업
- ▸PUT 요청으로 존재하지 않던 리소스를 새로 생성한 경우
해결 방법
- 1.201은 정상 응답이므로 수정이 필요하지 않습니다
- 2.응답에 Location 헤더를 포함하여 생성된 리소스 URL을 알려주세요
- 3.응답 본문에 생성된 리소스의 전체 데이터를 포함하는 것이 좋습니다
- 4.단순 조회 성공 시에는 200 OK를 사용하세요
관련 HTTP 헤더
LocationContent-TypeETag응답 예시
HTTP/1.1 201 Created
Location: /api/users/42
Content-Type: application/json
{"id":42,"name":"Jane Doe","email":"jane@example.com"}관련 상태 코드
200OKThe request has succeeded.→202AcceptedThe request has been accepted but not yet acted upon.→203Non-Authoritative InformationThe response is from a transforming proxy, not the origin server.→204No ContentThe server successfully processed the request but returns no content.→205Reset ContentThe server processed the request; the client should reset the document view.→
ad · 300×250
// related tools