I am working on a project that requires that I get the channelId of a User using their username with the Youtube V3 API and I'm facing some difficulty understanding what to set as the value of the "forUsername" param.
Looking at it, I believe that my misunderstanding comes from using the Account handle as the Username since while the request below
https://www.googleapis.com/youtube/v3/channels?key=API_KEY&forUsername=ganba_roll&part=id
(Example for https://www.youtube.com/@ganba_roll)
doesn't return any results:
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
}
}
A similar question's answer that used the request below as an example of how to retrieve a users channelId with the v3 API
https://www.googleapis.com/youtube/v3/channels?key=API_KEY&forUsername=klauskkpm&part=id
successfully returns
{
"kind": "youtube#channelListResponse",
"etag": "_eCbyZfbnzEHno7A-oBcP0LCzlI",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "JhuO0pv2b8motmYfYWvQrmif2a8",
"id": "UCfjTOrCPnAblTngWAzpnlMA"
}
]
}
I'm confused as to where to retrieve the value that I need to set the forUsername param to.
Thank you for your time!