I am using the YouTube API within my app. Users can log in with their Google+ account. I would like the user to be able to subscribe to certain YouTube channels.
There seems to be something for web here: https://developers.google.com/youtube/subscribe/
But I can't find something suited to Android. Am I missing something from the documentation or is there a workaround?
You don't need a specific Android library to subscribe an authenticated user to a specific channel. Just send an authenticated POST request to the subscriptions/insert
endpoint with the channelId
of the channel you want to subscribe to with the Part
param snippet
:
HTTP POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
Request body:
{
"snippet": {
"resourceId": {
"channelId": "XXXXX" // channel ID you want to subscribe to
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With