BuddyPress REST API Error Code
-
First, thank you for having such a robust AND extensible REST API. It has been a pleasure to work with. This is more of a comment for consideration than a bug or issue. Currently I am working on a project that is running WordPress headless with a React front-end. Today when working on a feature to add friends in the React front-end, I was hitting the buddypress/v1/friends route with a POST. I noticed during testing that if I hit the route again quickly it responds with an error message stating “Those users are already friends or have sent friendship request(s) recently.” This is a great and descriptive message, but the code is bp_rest_friends_create_item_failed and the status is a 500. With the status at 500 this immediately falls into my catch scenario. Could this be better served with a 202 and/or a error code that is along the lines of bp_rest_friends_item_exists or something similar. I know this is an edge case, but I thought I would bring it up for consideration. Thanks and keep up the great work!!
- You must be logged in to reply to this topic.