'What is a part in the youtube api v3, and how should I use it
I was trying to make the "try it now" work on the youtube api page in this link: https://developers.google.com/youtube/v3/docs/videoCategories/list#try-it What do I need to write in each text box? It is very unclear for a noob like me... The explanation about what a part is is very unclear. What a property is, where should I use these. There are no examples of usage. It is very frustrating. As a side note - this whole API documentation is as if written for someone who already knows how to use it.. very unfriendly.
Solution 1:[1]
Basic explanations are right next to each text box: more details can be found on the API Overview page, under Partial Resources.
part
: The part parameter specifies the videoCategory
resource parts that the API response will include Supported values are id and snippet.
Type in id
, snippet
, or id, snippet
.
regionCode
: instructs the API to return the list of video categories available in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. Type in us
or your country code.
Click the 'Execute' button to get results.
Solution 2:[2]
First, make sure you "Authorize requests using OAuth 2.0"
Next, in addition to entering id and snippet (The "bold red = required") you must provide at least one filter such as 'us' or your country code in the regionCode. Rather than give a bad request the instructions probably should have indicated that at least one filter is required. The automatically generated request should then show as something like:
GET https://www.googleapis.com/youtube/v3/videoCategories?part=snippet®ionCode=us&key={YOUR_API_KEY}
And you should see a response starting with something like:
200 OK
- Show headers -
{
"kind": "youtube#videoCategoryListResponse",
"etag": "\"NO6QTeg0-3ShswIeqLchQ_mzWJs/ktNNfqmO8tgQADyscLhmrqfzsa4\"",
"items": [
{
"kind": "youtube#videoCategory",
"etag": "\"NO6QTeg0-3ShswIeqLchQ_mzWJs/Xy1mB4_yLrHy_BmKmPBggty2mZQ\"",
"id": "1",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Film & Animation",
"assignable": true
}
},
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lee Goddard |
Solution 2 | victorkt |