# 「グループメンバー」呼び出しのAPIスコープ問題

**URL:** https://meta.discourse.org/t/api-scope-problem-for-group-members-call/368109
**Category:** Bug
**Tags:** pr-welcome
**Created:** [2025 年 5 月 29 日午後 3:40 UTC](https://meta.discourse.org/t/api-scope-problem-for-group-members-call/368109 "2025-05-29T15:40:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2025 年 5 月 29 日午後 3:40 UTC](https://meta.discourse.org/t/api-scope-problem-for-group-members-call/368109/1 "2025-05-29T15:40:51Z")

</div>

- APIキーを作成する

- スコープをグループ管理に設定し、グループのID（例：trust\_level\_0の場合は10）を入力する

- APIを呼び出す  
`curl -H \"Api-Key: ***\" https://test.example.com/groups/trust_level_0/members.json`

–

> 403 `{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}`

IDを試す  
`curl -H \"Api-Key: ***\" https://test.example.com/groups/10/members.json`

–

> 403 `{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}`

理由は、スコープが呼び出しを `id` というパラメータに制限しているためです。  
しかし、この特定の呼び出しでは、パラメータは `name` と呼ばれます。そのため、機能しません。

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

データベースをハッキングしてスコープを `{\"name\": [\"trust_level_0\"]}` に変更すると、この呼び出しは機能します（ただし、他のすべての呼び出しは壊れます）。

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2025 年 6 月 3 日午前 4:01 UTC](https://meta.discourse.org/t/api-scope-problem-for-group-members-call/368109/2 "2025-06-03T04:01:21Z")

</div>

うーん、 `GET /g/by-id/:id/members` を追加して、それをスコープに組み込む必要がありそうですね。

これに pr-welcome を追加します。
