Mackensie Alvarez
Mackensie Alvarez

Reputation: 11

Return Channel Earnings from YouTube API

I am trying to retrieve earnings from a channel in my CMS using the YouTube API. When I execute my query the response only contains the metrics datatype and not the actual value. How do I return the earnings from the API?

stdClass Object (
    [kind] => youtubeAnalytics#resultTable [columnHeaders] => Array (
        [0] => stdClass Object (
            [name] => earnings [columnType] => METRIC [dataType] => FLOAT
        )
        [1] => stdClass Object (
            [name] => grossRevenue [columnType] => METRIC [dataType] => FLOAT
        )
    )
)

Upvotes: 1

Views: 221

Answers (1)

not_a_bot
not_a_bot

Reputation: 2362

Are you getting the metrics from a Content owner report? To run a content owner report, make sure that you're authenticated as your YouTube CMS account, then set ids=contentOwner==CMS_ID and filters=channel==CHANNEL_ID or filters=video==VIDEO_ID.

Upvotes: 1

Related Questions