0

Im trying to fetch some data from the popular Morningstar api. I'm using axios and also using their code example for javascript - axios.

My code looks like this:

const options = { method: 'GET', url: 'https://morningstar1.p.rapidapi.com/dividends', params: {Ticker: 'MSFT', Mic: 'XNAS'}, headers: { accept: 'string', 'x-rapidapi-key': '700c7f0abamsh61a21d67f2579cdp1097e3jsn3fa403041f99', 'x-rapidapi-host': 'morningstar1.p.rapidapi.com' } }; useEffect(() => { axios.request(options).then(function (response) { console.log(response.data); // HERE I LOG THE DATA FROM API }).catch(function (error) { console.error(error); }); }, []) 

And the error i get when i console logs response.data is:

https://gyazo.com/9d8a5defd87088cdeb8bc2823261d60f

Anyone that has a solution to this error? Thank you!

    1 Answer 1

    1

    That is because you are not subscribed to this API: when running this code i got:

    {"message":"You are not subscribed to this API."}

    in the network tab in the dev tool. here is an image enter image description here

    2
    • Okey, where exactly did in the network tab did you find this?CommentedJan 14, 2021 at 15:04
    • No problem, i found it! Weird that they had "Test endpoints" tab when you cant test it...CommentedJan 14, 2021 at 15:09

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.