繁体   English   中英

如何使用 Yelp API 获取业务 ID 数组的数据?

[英]How to fetch the data of an array of business ids using Yelp API?

我有一个包含企业 ID 的长数组,我想获取与该 ID 关联的每个业务数据。

尽管使用 axios 并且正确的标题给了我结果,但由于以下错误/异常,我仍然会丢失一些数据: TOO_Many_Requests_Per_Second

我用于获取数据的代码如下:

const headers = {
        Authorization: 'Bearer <token>',
        'Content-Type': 'application/json',
      };
 data.maps(async (product : any) => {
        const res = await axios.get(`${URLS.FETCH_BUSINESS_DETAILS}/${product.businessId}`, { headers      });
      });

Yelp API 的开发人员文档包含有关此错误响应的以下信息:

每秒查询 (QPS) 速率限制

QPS 限制

如果您过快地对 API 进行查询,您可能会在 json 正文中收到 HTTP 429 错误:

{
    "error": {
        "code": "TOO_MANY_REQUESTS_PER_SECOND",
        "description": "You have exceeded the queries-per-second limit for this endpoint.
                        Try reducing the rate at which you make queries."
    }
}

如果您经常看到这些,请放慢您拨打 API 的速度。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM