# 現在のユーザーの場所に基づいて、社内広告を提供する方法はありますか？

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-serve-in-house-ads-based-on-the-current-users-location/280263>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [2023 年 9 月 27 日午前 6:39 UTC](https://meta.discourse.org/t/is-there-a-way-to-serve-in-house-ads-based-on-the-current-users-location/280263 "2023-09-27T06:39:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)\
**Post date:** [2023 年 9 月 27 日午前 7:37 UTC](https://meta.discourse.org/t/is-there-a-way-to-serve-in-house-ads-based-on-the-current-users-location/280263/3 "2023-09-27T07:37:06Z")

</div>

> [@Canapin](#):
>
> [https://your-discourse.com/admin/users/ip-info?ip={user\_ip}](https://your-discourse.com/admin/users/ip-info?ip=%7Buser_ip%7D)

@Canapin 様

迅速なご対応ありがとうございます！

これのために短いPythonスクリプトを作成しようとしましたが、JSONではなくWebページしか返ってきません。GET URLに`.json`を追加すると、`{}`しか返ってきません。しかし、ユーザーID (`https://your-discourse.com/admin/users/{user_id}/ip-info.json?ip={user_ip}`) を使用してリクエストを行うと、IPアドレスとともにユーザーの情報が表示されるようです。

ブラウザからそのURLにアクセスしようとしましたが、「おっと！そのページは存在しないか、プライベートです。」というエラーが表示されるだけでした。

ちなみに、私たちのDiscourseは現在Stableバージョン（v3.1.1）です。

これを使用するにはMaxMindライセンスが必要ですか？そうでない場合、提供されたエンドポイントが間違っている可能性はありますか？ `/admin/users/{user_id}.json`からは応答がありますが、`/admin/users/ip-info?ip={user_ip}`からは適切な応答が得られません。DiscourseサイトからHTMLの空白のWebページしか取得できません。

また、あなたが共有してくれたような、Discourseが提供する便利なエンドポイントのリストへのリンクはありますか？

ありがとうございます！

---

_[View the full topic](https://meta.discourse.org/t/is-there-a-way-to-serve-in-house-ads-based-on-the-current-users-location/280263)._
