# 是否可以通过 API 在尝试注册前检查新用户名的有效性？

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-check-validity-of-a-new-username-via-the-api-before-actually-trying-to-register/88153>\
**Category:** Development\
**Created:** [2018年五月22日 15:35 UTC](https://meta.discourse.org/t/is-there-a-way-to-check-validity-of-a-new-username-via-the-api-before-actually-trying-to-register/88153 "2018-05-22T15:35:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2018年五月22日 15:48 UTC](https://meta.discourse.org/t/is-there-a-way-to-check-validity-of-a-new-username-via-the-api-before-actually-trying-to-register/88153/2 "2018-05-22T15:48:05Z")

</div>

You might be interested in reading this

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. The API is documented at [docs.discourse.org](https://docs.discourse.org). You can also use the [discourse\_api](https://github.com/discourse/discourse_api) Ruby gem as a client library. However, not every endpoint is documented. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select …

FTR, you want the `/u/check_username` endpoint 😉

---

_[View the full topic](https://meta.discourse.org/t/is-there-a-way-to-check-validity-of-a-new-username-via-the-api-before-actually-trying-to-register/88153)._
