Using the API Data Source with Youtube

Hello,
Has anyone here managed to connect the API Data Source to Youtube at all? I followed the tutorial for unsplash without major issues but the Youtube data API seems far harder to decipher. I have the Url as https://www.googleapis.com/youtube/v3/search/ set and my key but always see an error below.

{
“error”: {
“errors”: [
{
“domain”: “global”,
“reason”: “required”,
“message”: “Required parameter: part”,
“locationType”: “parameter”,
“location”: “part”
}
],
“code”: 400,
“message”: “Required parameter: part”
}
}

I’m trying to do the same as with unsplash but instead pull videos from a particular channel for searching.
Any pointers appreciated.

Thanks and best regards,
Brian

Try adding a part parameter to it such as https://www.googleapis.com/youtube/v3/search?part=“snippet,contentDetails” as per this code snippet https://developers.google.com/youtube/v3/code_samples/code_snippets

Thank you Paul - much appreciated :smile:

1 Like

if it works. some screenshot of API Settings would be always helpful

Hi Freddy, Paul,

I’ve made some progress but suspect the error I have now may have something to do with my Google account as I am seeing unauthorised use exceeded (although it isn’t). I have included in the screenshot what I have which may work for you?

If I enter the code directly to the browser though, it does work so will investigate further.

https://www.googleapis.com/youtube/v3/activities?part=snippet%2CcontentDetails&channelId=UC-fR7d7Z2HheSUqFxzTq6Ow&maxResults=25&key=

Best regards,
Brian

Just wondering if the Header Parameter added of key is correct to gain access and if you wrapped the key entry inside single quotes or not?

Hi Paul,

In the header I have Name: key and in Value just single quotes around the key. The key works if you paste it directly as a browser URL so am a bit perplexed at the moment. Also, just noticed that the same URL that works in the browser is showing as a url connection 403 error in Wappler.
Cheers,
Brian

Oh Google requires the key as query parameter ( in the url) you should just define it as query parameter and not as header!

Now google is restricting you as it doesn’t sees the key.

So just move it to the query paeans where the rest of the options are and it should all work.

Hi George,

Ah, that fixed it. I removed the header and added the complete url containing the maxresults, channelId, part and key and the schema loads. Thanks for pointing out the Google change.

All the best,
Brian

Hi George,

I hope to have an end result to be a Youtube version to the showcase here: https://showcase.dmxzone.com/ApiMasonry/index.html

Following the unsplash tutorial, rather than add an image a binding image source, I added the video content type but have managed to link my videos or poster images to the page. Just before I go any further, can you confirm if I have chosen the wrong content type, please?

Thanks again,
Brian

1 Like