API Response
YouTube Data API response is in the form of JSON, and here is an example JSON object to understand how the API response looks like.
A JSON is built with certain objects which can be simple or nested, and we call those objects properties.
In a similar fashion, the response of Youtube Data API is in the form of JSON consisting of objects.
In order to understand the API response, we first need to understand the different components of the response.
What is a Resource?
A resource is an individual entity with a unique identifier, which can be a channel, channel banner, video, playlist, playlist item, and so on.
There are separate requests for each resource like the ones below.
- https://www.googleapis.com/youtube/v3/channels
- https://www.googleapis.com/youtube/v3/playlists
- https://www.googleapis.com/youtube/v3/playlistItems
What is a Partial Resource?
A partial resource determines a subset of all the resource properties to be included in the response.
API support two parameters to retrieve partial data of resources as mentioned below.
- Parameter "
part
" identifies a group of properties to be included in the response- Some valid values are "
snippet
",contentDetails
,statistics
- Some valid values are "
- Parameter "
fields
" identifies properties further inside the resource parts- It can be any property name within the specified properties identified by "
part
" parameter
- It can be any property name within the specified properties identified by "
API Documentation
Refer to the below documentation for more details
Overall
Before we proceed, make sure we are clear with the keywords "resource
", "partial resource
", "part
" parameter, and "fields
" parameter.