[wp-trac] [WordPress Trac] #61843: REST API endpoint /wp-json/wp/v2/categories returns 500 instead of 400
WordPress Trac
noreply at wordpress.org
Thu Aug 8 10:12:52 UTC 2024
#61843: REST API endpoint /wp-json/wp/v2/categories returns 500 instead of 400
--------------------------+-----------------------------
Reporter: mlf20 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 6.2.2
Severity: normal | Keywords:
Focuses: rest-api |
--------------------------+-----------------------------
When sending a request to the /wp-json/wp/v2/categories endpoint, it
returns a 500 response. Seems like it should return a 400 response code
for bad formatting instead of a 500, seeing as no exception is generated
and its handled cleanly by the server.
=== command to reproduce
curl -X POST "http://[WORDPRESSDOMAIN]/wp-json/wp/v2/categories" -d
'{"description": "ZD4ZDAJF", "name": "", "slug": "VZXC6HFM", "parent": 1}'
-H 'Authorization: Basic [ACCESSTOKWN]' -H 'Content-Type:
application/json'
=== Server Response
{{{
{"code":"empty_term_name","message":"A name is required for this
term.","data":null}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61843>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list