Skip to content

Commit e0cc8e3

Browse files
thegagneclaude
andcommitted
fix(133,137): correct Create/Apply HTTP response codes to 201
Create should return 201 Created, not 200 OK, per RFC 7231. Apply should return 201 when creating and 200 when updating. The aep-2026 release incorrectly specified 200 for both; this corrects that with should-level guidance to allow backwards compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent df45f50 commit e0cc8e3

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

aep/general/0133/aep.md.j2

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ Create methods implement a common request message pattern:
9090

9191
{% tab oas %}
9292

93-
{% sample '../example.oas.yaml', '$.paths./publishers/{publisher_id}/books.post.responses.200' %}
93+
{% sample '../example.oas.yaml', '$.paths./publishers/{publisher_id}/books.post.responses.201' %}
94+
95+
- The response **should** return a `201 Created` HTTP status code.
96+
97+
**Note:** The aep-2026 release incorrectly specified `200 OK` for Create
98+
responses. This guidance corrects that: `201 Created` is the appropriate status
99+
code per [RFC 7231][rfc-7231]. Implementations **should** accept `200` for
100+
backwards compatibility.
94101

95102
- The response **must** be the resource itself. There is no separate response
96103
schema.
@@ -195,6 +202,7 @@ the ID of the newly-created resource.
195202
Having a user-specified ID also means the client can precalculate the resource
196203
path and use it in references from other resources.
197204

205+
[rfc-7231]: https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.3
198206
[data plane]: ./0111.md#data-plane
199207
[errors]: ./0193
200208
[field_behavior]: ./0203

aep/general/0137/aep.md.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ Apply methods implement a common request message pattern:
108108

109109
{% tab oas %}
110110

111-
{% sample '../example.oas.yaml', '$.paths./publishers/{publisher_id}/books/{book_id}.put.responses.200' %}
111+
{% sample '../example.oas.yaml', '$.paths./publishers/{publisher_id}/books/{book_id}.put.responses' %}
112112

113-
- If the resource is created, the response **must** return a `201` status code.
114-
- If the resource is updated, the response **must** return a `200` status code.
113+
- If the resource is created, the response **should** return a `201` status code.
114+
- If the resource is updated, the response **should** return a `200` status code.
115+
116+
**Note:** The aep-2026 release incorrectly specified `200 OK` for both cases.
117+
This guidance corrects that: `201 Created` is the appropriate status code when
118+
a resource is created, per [RFC 7231][rfc-7231]. Implementations **should**
119+
accept `200` for backwards compatibility.
115120

116121
{% endtabs %}
117122

@@ -159,4 +164,5 @@ See [AEP-134's patch and put](/134#patch-and-put) for more information.
159164
- For ensuring idempotency in `Apply` methods, see [idempotency](/idempotency).
160165
- For naming resources involving Unicode, see [unicode](/unicode).
161166

167+
[rfc-7231]: https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.3
162168
[strong consistency]: ./0121.md#strong-consistency

aep/general/example.oas.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ paths:
196196
$ref: '#/components/schemas/isbn'
197197
required: true
198198
responses:
199-
'200':
199+
'201':
200200
content:
201201
application/json:
202202
schema:
@@ -269,7 +269,7 @@ paths:
269269
$ref: '#/components/schemas/publisher'
270270
required: true
271271
responses:
272-
'200':
272+
'201':
273273
content:
274274
application/json:
275275
schema:
@@ -354,7 +354,13 @@ paths:
354354
application/json:
355355
schema:
356356
$ref: '#/components/schemas/publisher'
357-
description: Successful response
357+
description: Successful response (updated)
358+
'201':
359+
content:
360+
application/json:
361+
schema:
362+
$ref: '#/components/schemas/publisher'
363+
description: Successful response (created)
358364
/publishers/{publisher_id}/books:
359365
get:
360366
description: List method for book
@@ -411,7 +417,7 @@ paths:
411417
$ref: '#/components/schemas/book'
412418
required: true
413419
responses:
414-
'200':
420+
'201':
415421
content:
416422
application/json:
417423
schema:
@@ -516,7 +522,13 @@ paths:
516522
application/json:
517523
schema:
518524
$ref: '#/components/schemas/book'
519-
description: Successful response
525+
description: Successful response (updated)
526+
'201':
527+
content:
528+
application/json:
529+
schema:
530+
$ref: '#/components/schemas/book'
531+
description: Successful response (created)
520532
/publishers/{publisher_id}/books/{book_id}/editions:
521533
get:
522534
description: List method for book-edition
@@ -579,7 +591,7 @@ paths:
579591
$ref: '#/components/schemas/book-edition'
580592
required: true
581593
responses:
582-
'200':
594+
'201':
583595
content:
584596
application/json:
585597
schema:

0 commit comments

Comments
 (0)