# 自定义用户字段搜索

**URL:** https://meta.discourse.org/t/search-with-custom-user-fields/282785
**Category:** Development
**Tags:** rest-api
**Created:** [2023年十月19日 11:59 UTC](https://meta.discourse.org/t/search-with-custom-user-fields/282785 "2023-10-19T11:59:14Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年十月19日 12:11 UTC](https://meta.discourse.org/t/search-with-custom-user-fields/282785/2 "2023-10-19T12:11:25Z")

</div>

在一定程度上是的。我昨天回答了同样的问题 🙂

> [@Adding non-visible user custom fields to the API](https://meta.discourse.org/t/adding-non-visible-user-custom-fields-to-the-api/276618/3?u=canapin):
>
> Yes, using query parameters: For example, [https://unicyclist.com/directory\_items.json?period=weekly&order=likes\_received&name=Flansberrium+G29&user\_field\_ids=1|2](https://unicyclist.com/directory_items.json?period=weekly&order=likes_received&name=Flansberrium+G29&user_field_ids=1%7C2) Restrict the user custom fields to search by modifying the last parameter user\_field\_ids=1|2. For example, user\_field\_ids=5 to search only in the custom field ID 5. There are also a couple of other available parameters you can find in [the API documentation](https://docs.discourse.org/#tag/Users/operation/listUsersPublic) (docs that don’t mention the user fields, but you can easily [reverse-enginee…](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576)

---

_[View the full topic](https://meta.discourse.org/t/search-with-custom-user-fields/282785)._
