I tried the API provided by Google but I never get the data joined field from the following.
https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token={access_token}
{
id: "xxx12212121",
email: "[email protected]",
verified_email: true,
name: "name",
given_name: "given",
family_name: "family",
link: "",
picture: "",
gender: "male",
locale: "en"
}
I get user info from this.
https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&access_token={access_token}
{
kind: "youtube#channelListResponse",
etag: ""m2yskBQFythfE4irbTIeOgYYfBU/z1gqFgh3CSk3IPqbcioKrdSLWC8"",
pageInfo: {
totalResults: 1,
resultsPerPage: 1
},
items: [
{
kind: "youtube#channel",
etag: ""m2yskBQFythfE4irbTIeOgYYfBU/ZhbI7F3l_8IFIKdqr4bM1ypv-vI"",
id: "UCaWN2zhl0zuSdZWW11WcYGg"
}
]
}
I get the channel id from this.
What should I include to get the date the YouTube user started or joined?
Information in the YouTube API is organized in so-called parts. In your example, you requested the id
part of the channel resource. The property you seek is contained in the snippet
part and is called publishedAt
.
So your URL should look like this:
https://www.googleapis.com/youtube/v3/channels?part=id,snippet&mine=true&access_token=ACCESS_TOKEN
Notice that you can request multiple parts by comma-separating them. This will get you the following result:
{
"kind": "youtube#channelListResponse",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/bFgk_cna5xETz2qMNX9ggxvvny8\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/TlIL_94eU05dqfDk52YIjQnlu6c\"",
"id": "UCaWN2zhl0zuSdZWW11WcYGg",
"snippet": {
"title": "Oliver Susano",
"description": "",
"publishedAt": "2006-07-04T07:42:01.000Z",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-K24hhru6jNo/AAAAAAAAAAI/AAAAAAAAAAA/Z9DpkE9NMqM/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-K24hhru6jNo/AAAAAAAAAAI/AAAAAAAAAAA/Z9DpkE9NMqM/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-K24hhru6jNo/AAAAAAAAAAI/AAAAAAAAAAA/Z9DpkE9NMqM/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
},
"localized": {
"title": "Oliver Susano",
"description": ""
}
}
}
]
}