Google places, with different api keys getting "You have exceeded your daily request quota for this API." - google-places-api

With google places API, autocomplete.
I'm getting the same response even when I create a new project, and put new API key in fetch.
Example:
mykey = different keys
https://maps.googleapis.com/maps/api/place/autocomplete/json?types=(cities)&key=mykey&language=en&components=country:us
Any ideas why is google always responding with status OVER_QUERY_LIMIT?

Related

As a content owner, how do I get access to content owner reports through YouTube Reporting API?

I'm using the YouTube Reporting API successfully to create channel reports, however I can't seem to access content owner reports. The account I'm authenticated in is a content owner, but when I tried to create a job for a content owner report I get a 403.
I think this is similar to this person's issue: Youtube reporting API returns 403 for content owner reports
One wrinkle is that when I get the channel via the api the contentOwnerDetails field is empty:
const { data } = await youtube.channels.list({
auth: oauth2Client,
part: 'snippet,contentDetails,statistics,topicDetails,contentOwnerDetails,localizations',
mine: true,
maxResults: MAX_RESULT_SIZE,
pageToken
});
However, I am a YouTube partner and this account is definitely a content owner. Is there some step I need to take to get a content owner id, or is there an API scope I'm missing (e.g., youtubepartner)?

Google Meet integration api (like Hangouts app for Slack)

I want to utilise Google Meet api, which is used in Hangouts integration for Slack, description follows
TL;DR:
Links such as https://meet.google.com/new?gid=123&gd=qwe987 can be generated, so a modal is shown which can ask user's confirmation and then some request is sent from user's browser (where the Google Meet page is opened) to some endpoint (probably it is determined from gid which seems to be google application id). Is there a way to configure my application to have a webhook, so I can generate these custom links?
There's Google+ Hangouts app for Slack. Here's how it works (after you add the app in your workspace):
you send /hangout command in any Slack channel
slackbot sends an "Only visible to you" message in this channel with a link to start a new hangout. it looks smth like this (I changed data in the link): https://meet.google.com/new?gid=691521906844&gd=THTJ30X6W%7CU01113BD13M%7CD01113BDB5Z%7Csuren%7C%7C1846381238693%7C1%7CB01QFGG5GJF%7CE1MDm4DWcuVa0RbN5ZT9o5KF
when you visit the link, a new meeting is started instantly, and the page shows modal with text "To bring others into this video call, post a link it to your Slack channel" with buttons 'Cancel' and 'Post'.
when you click 'Post', a new message is sent to the Slack channel, where the command was sent. Text is "#Suren Khorenyan has started a Google+ Hangout and would like you to join. Join Hangout." and contains a link to the meet, which was created previously
How can I utilise this integration for another app, like Mattermost (or anything else like Telegram chats via bots)?
As I see, data in the url slightly changes. Probably it's payload for Google Meet to trigger Slack to send a message with link to the channel.
gid seems to be something like google app id
gd seems to be something like google data. If I url-decode it, it becomes THTJ30X6W|U01113BD13M|D01113BDB5Z|suren||1846381238693|1|B01QFGG5GJF|E1MDm4DWcuVa0RbN5ZT9o5KF. This is some kind of payload, separated by pipes (obviously), but I don't know what any part of this means (suren is my username in the Slack workspace, probably this is used for creating an invitation message).
When I click Post, this happens:
a new POST request to https://hooks.slack.com/services/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 is sent with form-data
hangout_id: 1812381238693
hangout_url: https://meet.google.com//abc-iuqx-def
a new message is posted to the Slack channel
Google meet somehow knows where to post back! Is this configured at the Google application (application id is provided via gid)? How can I configure my application for such behaviour? Where can I setup webhook url?
If we breakdown the request, we can see that url contains some parts of the gd payload:
THTJ27X6W - this is the first part of the gd payload
B01ABCD5GJF - last but one
E1MDm4DWcuVa0RbK5ZT9o5KD - the last part of the gd payload
and form-data contains:
hangout_id - this is in the gd payload after my name
hangout_url - obviously, this is the url for the new created meeting
How can I change it for my needs?
I created a new application at Google APIs dashboard (here console.developers.google.com/apis), but can't find any docs for this integration. There's Google+ Hangouts API in API Library, but it says Apps will continue to function until April 25, 2017..
I tried to approach it from another side:
In the API Library there's Google Calendar. I found mattermost-hangout app on GitHub (had to update it a bit, so it works with updated api). Here's how it works:
oauth2 for authorising at google (single account)
it handles POST request, which is meant to be received from Mattermost (triggered by a slash command),
creates a new calendar event using Google Calendar API (with conference),
takes hangouts url from the response and sends a new message in the Mattermost channel with invitation to join the meeting.
But it has some downsides:
you have to use one account to authorise all event creation events (yeah, it can be upgraded to authorise any number of users, but it'll be inconvenient. why to force anyone to provide access to their Google Account, when Google Meet authorisation just happens in browser, we don't need to create events)
account, used for auth, now has events in his calendar. of course, events can be deleted, but it's not the way.
Is there any documentation on utilising gid and gd params?
Generally, I want to find a way to configure a webhook in my app, so when Google Meet finds my application's ID in the gid query param, it looks at the app's config and sends a request to my app (previously configured endpoint (I assume it works this way)).
Of course there's a chance that it's some kind of internal API and it cannot be used by everyone, but I could not find any information on this.

Luis: Access denied due to invalid subscription key

I am facing following issue when i try to update application on Luis using following request:
https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/app-id-here
header:
Ocp-Apim-Subscription-Key:paid-subscription key
body:
{
"name": "Name of luis app",
"description": "string"
}
I am getting following error:
{
"statusCode": 401,
"message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription."
}
I am using paid subscription from Azure portal with westus region. Still facing this issue.
However, This key works when I try to get top scoring intent using following request:
https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/luis-app-id?subscription-key=subscription-key-azure&timezoneOffset=-360&q=hi
This is really weird as sunscription key works for GET request but not for PUT or POST request.
Any suggestions?
PS: I am using paid subscription key.
The (subscription) keys created with a Cognitive Service LUIS resource in Azure Portal, even when added to with Assign resource in luis.ai, can only be used for runtime queries on a defined app.
The authoring endpoints on LUIS Programmatic APIs v2.0 - to create and manage apps and their elements - can only be used with the Authoring Key available in the luis.ai portal.
More information can be found in Authoring and query prediction endpoint keys in LUIS
It looks like you have two issues you are working thru here.
First, the API you are trying to post to should read "https://[location].api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/publish". From the looks of it, you are missing the 'publish' at the end of your API call.
Second, the paid subscription key needs to be added to your LUIS app. Can you confirm it has been added? If not, follow these steps to do so:
Click Manage => Keys and Endpoints.
Next, click 'Assign resource'.
A window will pop up allowing you to select the tenant, subscription, and the key to use.
Click OK.
Click 'Publish' to make the newly generated endpoint accessible.
Make sure you add subscription primary key value in my request and also make sure you have associated your API with the product which you used the Primary key

How long are nextPageTokens remembered for Gmail and Calendar APIs?

The Gmail and Calendar APIs return a nextPageToken value in the response from the users.messages.list and events.list endpoints when pagination is required. If the value of the nextPageToken is provided in the next request to these endpoints, the next page of results is returned.
My question: How long are these nextPageTokens persisted behind the Gmail and Calendar APIs?
Context: I am building an abstraction on top of both the Gmail and Calendar APIs to return a list of Activities, and this endpoint has its own pagination. My pagination works by storing the nextPageToken values returned by the Gmail and Calendar APIs in a cache and returning a UUID the client can specify in the next request to pop and use those Gmail and Calendar nextPageTokens (just like the Google APIs themselves).
Goal: Configure my pagination cache TTL to, at most, be equal to the TTL (if there is one) of the Google APIs so that it always works as intended.
nextPageToken does not expire. It is just like an Index position. However if new items are added/deleted, you might not see the same result as you expect.
The token expires after 1 Hour. I came to know about that while working with Google Directory API. Link to the problem I faced.

How to get error responses from YouTube v3 API :YoutubeService

I am currently using the Google YouTube V3 API to get view counts for few videos on You Tube.
I would like to parse the response to get results when view counts cannot be retrieved. Example “This video is private” or “The uploader has not made this video available”
I need to retrieve this part “This video is private”.
Here is a snippet of my code
Using Google.Apis.Youtube.v3.YoutubeService
private YoutubeService youtube;
var YTVideo = youtube.Videos.List(ytidobj.ToString(), "statistics");
var ViewCountResponse = YTVideo.Fetch()
I am able to get view counts from this call without any issues but I can’t seem to get the error responses?
How can get the error responses back from the the call : var ViewCountResponse = YTVideo.Fetch()
I tried to access the details of my private YouTube video from two accounts, one of which is the owner of the video, via YouTube Data API v3. The owner of the video received the full properties (including "privacyStatus": "private" with no issues, but the other account received a 200 OK response without any properties or details.
It seems like only the owners of the private videos are given a response, while other users will receive an empty response as though no such videos exist. YouTube Data API - Errors does not seem to include error responses for private videos either.
If you need to inform the user should there be an empty response, I suggest a message of "This video does not exist or is made private by the uploader" or something similar.
If you need to know if a video exists but is private, without being its owner, I don't think the v3 API is capable of that.
Which is making sense. The "private" state would not be private, if anyone could see there is a video.

Resources