Proper route for checking resource existence in a RESTful API [closed]

HEAD is the most effecient for existence checks:

HEAD /users/{username}

Request a user’s path, and return a 200 if they exist, or a 404 if they don’t.

Mind you, you probably don’t want to be exposing endpoints that check email addresses. It opens a security and privacy hole. Usernames that are already publicly displayed around a site, like on reddit, could be ok.

Leave a Comment