# カスタムユーザーフィールドでの検索

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

<div class="post-metadata">

### Author: ![Hitesh\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hitesh_sharma/32/309992_2.png) [@Hitesh\_Sharma](https://meta.discourse.org/u/Hitesh_Sharma)
#### Post date: [2023 年 10 月 19 日午前 11:59 UTC](https://meta.discourse.org/t/search-with-custom-user-fields/282785/1 "2023-10-19T11:59:14Z")

</div>

Discourse APIでカスタムフィールドを持つユーザーを検索できますか？

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/9/4/794c766aa1405fcf275fa5a4740dddb0bef2f829.png)

---

<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 年 10 月 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)

---

<div class="post-metadata">

### Author: ![Hitesh\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hitesh_sharma/32/309992_2.png) [@Hitesh\_Sharma](https://meta.discourse.org/u/Hitesh_Sharma)
#### Post date: [2023 年 10 月 19 日午後 12:56 UTC](https://meta.discourse.org/t/search-with-custom-user-fields/282785/3 "2023-10-19T12:56:38Z")

</div>

しかし、ユーザーフィールドの値として **1vic** を渡した場合は機能しましたが、 **“sgroup\_admin”** では機能しませんでした。

> **[SupportGroups™ - Mental Health Support & Community](https://supportgroups.com/directory_items.json?period=weekly&order=likes_received&name=1vic&user_field_ids=5)**
>
> Join over 350,000 members in our supportive community. We're committed to making therapy, support, and personal growth affordable and accessible to everyone.

 ![Screenshot from 2023-10-19 18-26-58](https://global.discourse-cdn.com/meta/original/4X/9/6/1/961ae4447553f3a456b8de63d6d37ae68143d7a9.png)

@Canapin
