Opened 4 months ago
Last modified 4 months ago
#61843 new defect (bug)
REST API endpoint /wp-json/wp/v2/categories returns 500 instead of 400
Reported by: | mlf20 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.2.2 |
Component: | REST API | Keywords: | has-patch |
Focuses: | rest-api | Cc: |
Description
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}
Change History (1)
This ticket was mentioned in PR #7170 on WordPress/wordpress-develop by @devansh2002.
4 months ago
#1
- Keywords has-patch added
Note: See
TracTickets for help on using
tickets.
Add http status code to errors earlier they were getting error code 500.
Trac ticket: https://core.trac.wordpress.org/ticket/61843