[wp-trac] [WordPress Trac] #41370: REST API: Attempting to create an existing term yields HTTP 500
WordPress Trac
noreply at wordpress.org
Wed Aug 16 19:58:48 UTC 2017
#41370: REST API: Attempting to create an existing term yields HTTP 500
-------------------------------------------------+-------------------------
Reporter: jnylen0 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
Component: REST API | Release
Severity: normal | Version: 4.7
Keywords: needs-unit-tests good-first-bug | Resolution:
needs-testing | Focuses: rest-api
-------------------------------------------------+-------------------------
Changes (by alibasheer):
* keywords: needs-patch needs-unit-tests good-first-bug => needs-unit-
tests good-first-bug needs-testing
Comment:
Hello @jnylen0,
I added patch 41370.patch, this is my first patch, please let me know your
feedback if I am doing it right. Here are my thoughts:
* I think it is better to return `409 Conflict` as it is trying to create
existing term, but I checked what you are returning in other cases like
when creating existing post, or existing user and found you are sending
`400 Bad Request`. I ended up setting this to `400 Bad Request`
* I couldn't fix the status without affecting the returned error
structure. It was returning the term id in the `data` directly, but now I
am returning an array of 2 elements in the `data`, the `term_id` and
`status`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41370#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list