# API 搜索操作过于频繁

**URL:** https://meta.discourse.org/t/api-search-action-too-many-times/155773
**Category:** Support
**Created:** [2020年六月24日 07:19 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773 "2020-06-24T07:19:11Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年六月24日 07:19 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/1 "2020-06-24T07:19:11Z")

</div>

错误：您执行此操作的次数过多，请稍后再试。

我有一个网站需要调用 Discourse 的搜索功能来导出主题。目前高峰期大约有 100 次请求。  
但我收到了上述错误！  
那么如何增加此限制呢？或者如果默认有限制，我是否需要其他解决方案来从其他网站调用 API？

`我使用的是：curl: http://meta.discourse.org/search/query.json?term=limit`

一些当前设置！

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/4/5486f8d5679ce33e337796b4f6a11d09a8c60b15.png)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2020年六月25日 11:47 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/2 "2020-06-25T11:47:38Z")

</div>

您想做什么？也许有更好的方法，不必进行如此多的搜索调用。

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年六月26日 01:44 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/3 "2020-06-26T01:44:40Z")

</div>

我想在第二个网站上显示该主题。  
使用 domain2 / url /  
使用 url 将在我的 Discourse 中搜索。

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年六月26日 06:55 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/4 "2020-06-26T06:55:49Z")

</div>

在 CURL 的头部中，我使用了 Api-Key 和 Api-Username

```plaintext
{"posts":[],"users":[],"categories":[],"tags":[],"groups":[],"grouped_search_result":{"more_posts":null,"more_users":null,"more_categories":null,"term":null,"more_full_page_results":null,"can_create_topic":false,"error":"您执行此操作的次数过多，请稍后再试。","post_ids":[],"user_ids":[],"category_ids":[],"tag_ids":[],"group_ids":[]}}

```

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年六月30日 04:54 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/5 "2020-06-30T04:54:35Z")

</div>

似乎受 IP 限制。有什么办法吗？

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2020年七月3日 00:15 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/6 "2020-07-03T00:15:20Z")

</div>

使用管理员的 Api-Username 可以绕过部分（注意：并非全部）速率限制。

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [2020年七月3日 06:32 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/7 "2020-07-03T06:32:32Z")

</div>

您是否在本地缓存数据？

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年七月4日 05:51 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/8 "2020-07-04T05:51:05Z")

</div>

> [@riking](#):
>
> 使用管理员的 Api-Username 可以绕过部分（！）速率限制。

主题内容在保存后会被缓存 24 小时（键值为 24 小时），之后在相同时间点再次获取时，会同时处理多个主题。

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年七月4日 05:51 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/9 "2020-07-04T05:51:34Z")

</div>

我会尝试。当前 API 用户 USER

---

<div class="post-metadata">

### Author: ![Fenil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fenil/32/192592_2.png) [@Fenil](https://meta.discourse.org/u/Fenil)
#### Post date: [2020年九月3日 13:30 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/10 "2020-09-03T13:30:43Z")

</div>

@Bcat 我也遇到了同样的问题。你是如何解决这个问题的？

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [2020年九月4日 01:55 UTC](https://meta.discourse.org/t/api-search-action-too-many-times/155773/11 "2020-09-04T01:55:58Z")

</div>

我会先缓存并写入文件，在记录前搜索该文件，并在24小时后再次调用搜索。
