【问题标题】:How to get rid of this - message:{'You are not subscribed to this API.'}.?如何摆脱这个 - 消息:{'你没有订阅这个 API。'}。?
【发布时间】:2020-08-10 05:46:10
【问题描述】:
import React from 'react';
import './App.css';

function App() {
    fetch("https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/quickAnswer?q=How%20much%20vitamin%20c%20is%20in%202%20apples%253F", {
            "method": "GET",
            "headers": {
                "x-rapidapi-host": "[host]",
                "x-rapidapi-key": "[key]"
            }
        })
        .then(response => {
            console.log(response);
        })
        .catch(err => {
            console.log(err);
        });
    return ( <
        div className = "App" >
        <
        form className = 'searchform' >
        <
        input className = 'search-bar'
        type = "text" / >
        <
        button className = 'search-bar'
        type = 'text' > Submit < /button> < /
        form > <
        /div >
    );
}

export default App;

【问题讨论】:

  • 订阅那个 API?此外,您现在需要轮换您刚刚公开共享的凭据。
  • @jonrsharpe 说了什么。 docs.rapidapi.com/docs/… 可能对这个 bt 有帮助我不确定,我以前没有使用过这个 api。
  • 我面临同样的问题。您是否设法找到任何解决方案?

标签: reactjs api


【解决方案1】:

如果您没有订阅 api,请确保您确实订阅了 rapid api hub 上的 api 您将收到一条错误消息,通知您没有有效订阅,并且您的通话不会 如果您没有订阅 api,请确保您确实订阅了 rapid api hub 上的 api 您将收到一条错误消息,通知您没有有效订阅,并且您的通话不会 成功

消息:你没有订阅这个api rapidapi

video example

【讨论】:

    【解决方案2】:

    确保您选择的计划是免费计划还是高级计划。

    https://rapidapi.com/tipsters/api/hotels-com-provider/pricing

    【讨论】:

      【解决方案3】:

      对于遇到此问题的其他人:我所做的疏忽是在 RapidAPI 密钥中添加了“Bearer”。它应该只是钥匙,前面没有任何东西。

      【讨论】:

        【解决方案4】:

        您必须选择定价计划,即使它是免费计划。转到 API 页面上的“定价”,然后选择一个计划。这解决了我的问题。

        https://api.rakuten.net/Top-Rated/api/e-mail-check-invalid-or-disposable-domain/discussions/9487/keep-getting-this-response-%22You-are-not-subscribed-to-this-API.%22

        【讨论】:

          【解决方案5】:

          如果您在 RapidAPI 上的所有设置都正确,我建议您在不使用变量的情况下传递密钥,因为您可能传递的是未定义的。对于 undefined,我们得到完全相同的错误。

          【讨论】:

            【解决方案6】:

            也许问题出在 GET 上,试试这个。让我知道它是否有效。

            state = {
                url:
                  "<url>",
                header: {
                  "x-rapidapi-host": "<host>",
                  "x-rapidapi-key": "<key>"
                }
              };
            
              componentDidMount() {
                axios
                  .post(this.state.url, this.state.header)
                  .then(res => {
                    console.log(res.data);
                  })
                  .catch(err => console.log("err" + err));
              }
            

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2020-08-04
              • 2022-11-16
              • 2021-07-07
              • 1970-01-01
              • 2016-10-02
              • 1970-01-01
              • 2012-02-05
              • 2020-11-29
              相关资源
              最近更新 更多