![]() ![]() For example, you can retrieve events associated with a particular channel or with the user's own channel. Returns a list of channel activity events that match the request criteria. Each activity resource identifies the type of action, the channel associated with the action, and the resource(s) associated with the action, such as the video that was rated or uploaded.įor more information about this resource, see its resource representation and list of properties. The actions reported in activity feeds include rating a video, sharing a video, marking a video as a favorite, uploading a video, and so forth. Use the HTTP Authorization header like this: Authorization: Bearer oauth2-tokenĬomplete instructions for implementing OAuth 2.0 authentication in your application can be found in the authentication guide.Īn activity resource contains information about an action that a particular channel, or user, has taken on YouTube. ![]() Use the access_token query parameter like this: ?access_token= oauth2-token.You can provide an OAuth 2.0 token in either of the following ways: The API supports the OAuth 2.0 authentication protocol. For example, a request to retrieve a user's uploaded videos may also contain private videos if the request is authorized by that specific user. In addition, some API methods for retrieving resources may support parameters that require authorization or may contain additional metadata when requests are authorized. You must also send an authorization token for any request that retrieves the authenticated user's private data. ![]() You must send an authorization token for every insert, update, and delete request. ![]() Your API key is available in the Developer Console's API Access pane for your project. The following requirements apply to YouTube Data API requests:Įvery request must either specify an API key (with the key parameter) or provide an OAuth 2.0 token. The guide also lists one or more supported methods ( LIST, POST, DELETE, etc.) for each resource type and explains how to use those methods in your application. For each resource type, the guide lists one or more data representations, and resources are represented as JSON objects. A resource represents a type of item that comprises part of the YouTube experience, such as a video, a playlist, or a subscription. This reference guide explains how to use the API to perform all of these operations. The API also supports methods to insert, update, or delete many of these resources. The lists below identify the different types of resources that you can retrieve using the API. If a non-integer value is specified, the field is ignored.The YouTube Data API lets you incorporate functions normally executed on the YouTube website into your own website or application. This must be an integer, specifying the reconnection time in milliseconds. If the connection to the server is lost, the browser will wait for the specified time before attempting to reconnect. The event ID to set the EventSource object's last event ID value. When the EventSource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline character between each one. The onmessage handler is called if no event name is specified for a message. If this is specified, an event will be dispatched on the browser to the listener for the specified event name the website source code should use addEventListener() to listen for named events. client closes the page).Įach message received has some combination of the following fields, one per line: eventĪ string identifying the type of event described. To break the loop if the connection has been closed (e.g. The loop will keep running independent of the connection status, so a check is included At random intervals, a simple message (with no event type) is sent. Each event's data is a JSON object containing the ISO 8601 timestamp corresponding to the time at which the event was generated. The code above generates an event every second, with the event type "ping". Date_default_timezone_set ( "America/New_York" ) header ( "Cache-Control: no-store" ) header ( "Content-Type: text/event-stream" ) $counter = rand ( 1, 10 ) while ( true ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |