I am trying to perform this request:
GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=contentOwner%3D%myId&start-date=2014-05-01&end-date=2014-06-30&metrics=views&dimensions=province&filters=channel%3D%chanId%3Bcountry%3DUS&sort=- estimatedMinutesWatched&key={YOUR_API_KEY}
My aim is to generate a content owner report for a given channel that we manage that will return views and earnings information for only US states.
The above returns this error:
400 Bad Request
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Could not parse content (N/A) of field parameters.filters."
}
],
"code": 400,
"message": "Could not parse content (N/A) of field parameters.filters."
}
}
I am using the documentation on the API Explorer page and my request appears to be correct.
Any help would be greatly appreciated.
Your problem is you use filters with "=" instead of "==" like "channel==ID"
After that, you will have another problem. I tried same query and it worked with adding estimatedMinutesWatched into views. To use that as sort order, you need to use it in views or dimensions.
Here's my request:
GET
https://www.googleapis.com/youtube/analytics/v1/reports?ids=contentOwner%3D%3DCONTOWNER&start-date=2014-05-01&end-date=2014-06-30&metrics=views%2CestimatedMinutesWatched&dimensions=province&filters=channel%3D%3DUCBLABLA%3Bcountry%3D%3DUS&sort=-estimatedMinutesWatched&key={YOUR_API_KEY}
Make sure your request fits one of https://developers.google.com/youtube/analytics/sample-requests#Content_Owner_Reports
and try it in https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v1/youtubeAnalytics.reports.query
Related
I made a question yesterday, asking to get the "id" from the outlook mail URL, like this:
https://outlook.live.com/mail/0/inbox/id/AQQkADAwATM0MDAAMS0xZGUwLTNjMTAtMDACLTAwCgAQAB%2FnQ1lgT6dDlqIakp3j4qk%3D
But it turns out that that is not the message id, for some reason.
Is there any way to get the actual message id with javascript?
Im using this to interact with the microsoft graph api. Have a look here to see what i'm trying to do.
Message id is the id of any message you get using List Messages. The Graph API follows REST API design. I suggest you do the resource navigation through Graph. Don't copy id from outlook client and use on Graph.
List messages:
GET https://graph.microsoft.com/v1.0/me/messages
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('bb8775a4-4d8c-42cf-a1d4-4d58c2bb668f')/messages(sender,subject)",
"value": [
{
"#odata.etag": "W/\"CQAAABYAAADHcgC8Hl9tRZ/hc1wEUs1TAAAwR4Hg\"",
"id": "AAMkAGUAAAwTW09AAA=",
"subject": "Welcome to our group!",
...
}
]
}
Then get one message:
GET https://graph.microsoft.com/v1.0/me/messages/AAMkAGUAAAwTW09AAA=
{
"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('cd209b0b-3f83-4c35-82d2-d88a61820480')/messages(subject,body,bodyPreview,uniqueBody)/$entity",
"#odata.etag":"W/\"CQAAABYAAABmWdbhEgBXTophjCWt81m9AAAoZYj4\"",
"id":"AAMkAGUAAAwTW09AAA=",
"subject":"Welcome to our group!",
"bodyPreview":"Welcome to our group, Dana!",
...
}
Fixed it!
GET https://graph.microsoft.com/v1.0/me/messages
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('bb8775a4-4d8c-42cf-a1d4-4d58c2bb668f')/messages(sender,subject)",
"value": [
{
"#odata.etag": "W/\"CQAAABYAAADHcgC8Hl9tRZ/hc1wEUs1TAAAwR4Hg\"",
"id": "AAMkAGUAAAwTW09AAA=",
"subject": "Welcome to our group!",
...
}
]
}
Get a list of messages, and for every message, if the conversationID matches the outlook ID (with / replaced with -) then that is the email
I need all google reviews for particular location but I am unable to use business api from google. Here is url for get request
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
Now my question is what is the value for param account_name and location_name
How can I get that.
Please answer with sample location example
I think first of all you need to white list your google my business api for whatever project you are working on in your project as its private api. Google my business api will work on the locations associated with your account so make sure you verified the LOCATIONS from any account you know. Then you can try out the api call you mentioned in OAuthplayground.
Follow steps mentioned in below documentation URL to set it up:
https://developers.google.com/my-business/content/prereqs
After the setup and etc you will automatically understand the account id and location id.
Also few more urls you can go to understand it better.
https://console.developers.google.com (here you will setup your project)
https://business.google.com/manage (here you will add/can see the locations - for which you need reviews)
https://developers.google.com/my-business/content/basic-setup (Steps after completing the prereq)
https://developers.google.com/oauthplayground (You will test the my
business api here after approval)
When you make a request to https://mybusiness.googleapis.com/v3/accounts it gives you a list of accounts. On those accounts they have a field called name. That field is accounts/account_name.
{
"state": {
"status": "UNVERIFIED"
},
"type": "PERSONAL",
"name": "accounts/1337",
"accountName": "example"
}
When you make a request to https://mybusiness.googleapis.com/v3/accounts/account_name/locations it gives you a list of locations. On those locations they have a field called name. That field is accounts/account_name/locations/location_name.
{
"locations": [
{
"languageCode": "en",
"openInfo": {
"status": "OPEN",
"canReopen": true
},
"name": "accounts/1337/locations/13161337",
...
}
I'm able to use GMail's Users.threads.list API call to retrieve a list of the threads. I'd like to also grab the labels belonging to each message in the thread.
On the official documentation / live example for this method, there is an area called fields where the user can specify the optional fields they wish to pull in. They even provide a little UI tool call 'fields editor' to help you select and properly format the fields for inclusion in the REST query:
Which results in the following, valid, generated fields parameter values:
nextPageToken,resultSizeEstimate,threads(historyId,id,messages/labelIds)
The final request looks like this:
GET https://www.googleapis.com/gmail/v1/users/me/threads?includeSpamTrash=true&fields=nextPageToken%2CresultSizeEstimate%2Cthreads&key={YOUR_API_KEY}
After authenticating with OAuth2, I get back a list of threads[], but none of them include the expected messages[] array nested within them! I know the field mask is valid because GMail API errors out when you request a field the method doesn't support with a standard HTTP 400 and a pretty printed error message. But in this case, all I get back is an object that contains an array labeled "threads", where each thread object only has the following fields:
id
snippet
historyId
But no messages array. Stranger yet, even when I remove the fields custom filter parameter, I still get back these same results. Am I missing something obvious here?
You have to list the id of the threads first, and then make a separate request to get the thread and fields in the messages you want. The API Explorer allows you to select additional fields when listing for some reason.
1. List ids
Request
GET https://www.googleapis.com/gmail/v1/users/me/threads?access_token={access_token}
Response
{
"threads": [
{
"id": "1570f8c16a1084de",
"snippet": "Foo bar...",
"historyId": "1234"
}, ...
],
"resultSizeEstimate": 100
}
2. Get the thread
Request
GET https://www.googleapis.com/gmail/v1/users/me/threads/1570f8c16a1084de?access_token={access_token}
Response
{
"id": "1570f8c16a1084de",
"historyId": "1234",
"messages": [
{
"id": "1570f8c16a1084de",
"threadId": "1570f8c16a1084de",
"labelIds": [
"INBOX",
"IMPORTANT",
"CATEGORY_FORUMS"
], ...
}
}
If you don't want to list threads and then get them all separately, you could use batch requests to bring it down to 2 requests instead.
I have all rights of Admin Account Though I am not Able Fetch Data of My custom dimensions
I need this data of My Account .
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customDimensions/list
But it gives me below error : Note: i have all right of this account ..
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "User does not have sufficient permissions for this account."
}
],
"code": 403,
"message": "User does not have sufficient permissions for this account."
}
}
if Anyone face this issue please suggest me
You need to provide the correct Analytics Account Id and Property Id. An easy way to get all available Ids is by calling accountSummaries.list:
function listAccountSummaries() {
var request = gapi.client.analytics.management.accountSummaries.list();
request.execute(handleResponse);
}
The insufficientPermissions error tells me that you requested the data from an account and property that does not belong to you. IE you provided an account and property Id which was not in the list from the API call above.
Perhaps you authenticated the application with your personal account and not the admin account.
I am trying to get the duration of a youtube video via search
var request = gapi.client.youtube.search.list({
q: q,
type : "video",
maxResults : 10,
part: 'snippet,contentDetails'
});
as an additional part parameter I added contentDetails in order to get the duration as you can see in their doc.
https://developers.google.com/youtube/v3/getting-started
Now comes the silly part. The response I get is the following:
[
{
"error": {
"code": -32602,
"message": "contentDetails",
"data": [
{
"domain": "youtube.part",
"reason": "unknownPart",
"message": "contentDetails",
"locationType": "parameter",
"location": "part"
}
]
},
"id": "gapiRpc"
}
]
"As such, the part parameter requires you to select the resource components that your application actually uses"
Thats what I did and now they dont know their own parameter anylonger?
So I was wondering how can I retrieve the duration order contentDetails in general?
best
phil
As written in the document, for search->list call, part can only take value "snippet".
Depending on the kind of the response, as a secondary call, you can do one of videos->list, playlists->list, channels->list with the id and part=snippet,contentDetails to get more details of each result item.