Home > Software design >  Vue, Axios, making a get request to YouTube search API return 404
Vue, Axios, making a get request to YouTube search API return 404

Time:03-28

Not sure what I am doing wrong. I am trying to make a get request to YouTube API for a keyword. The query string now is returning 404 I a have added referring urls and have current api key.

My method where I am making call with axios.The location logs out fine.

async getYouTubeVideoId(location) {
    console.log({ location })
    try {
      const response = await axios.get(
        `https://www.googleapis.com/youtube/v3/search?key="mykeyinquotes"&type=video&part=snippet&maxResults=5&q=${location}`
      )
      console.log(response.data)
    } catch (error) {
      console.log({ error })
    }
  },

Here is where I am calling method

 async created() {
    this.getLocationData()
    await this.getWikiData(this.pickedLocation.name)
    await this.getYouTubeVideoId(this.pickedLocation.name)
    this.asyncDataStatus_fetched()
  }

CodePudding user response:

API key should not be in quotes.

  • Related