i have online tool that works with users based on oauth 2.0. I have access to their Google Analytics, etc.
The only one that i can't access is PageSpeed API because i don't know and can't find scope URL of this service.
For Google Analytics, for example, i use https://www.googleapis.com/auth/analytics.readonly scope etc. But it seems like PageSpeed api does'nt have any scope and is accessible only with user API key. But in that case i can't offer to my users Pagespeed insights for their pages (because one API key has only 50 000 queries/day).
I did'nt find even in Oauth playground on:
https://developers.google.com/oauthplayground/
Can you please help me how to solve this problem if i don't wanna press users to Google Developer Console?
Thank you!
PageSpeed API access works fine with just an API key (as mentioned in the Google Developers Console, see the subpage there for the PageSpeed API) which is also much easier to implement for the developer.
I think this is the case because one can by default run pagespeed for any given URL, so no need for a permission workflow as opposed to Google Analytics etc.
As answered above, it should work just fine with an api call. As per the Google PageSpeed Insights API.
This is your API URL for v2 of the API:
'https://www.googleapis.com/pagespeedonline/v2/runPagespeed?'
The current version however is, v4. So that looks like this: https://www.googleapis.com/pagespeedonline/v4/runPagespeed
Here's a sample function to call Pagespeed API, using v2:
def runPageSpeed(API_URL, API_KEY, input_url, insightstrategy):
query = [
'url=' + input_url,'filter_third_party_resources=true',
'key='+api_key, 'strategy='+insightstrategy] #insight strategy is either 'desktop' or 'mobile'
src = API_URL + '&'.join(query)
return src
P.S: you will need API Key, which you can generated under Google Developers, in order to run it. Also the following packages: (as per I checked last):
google python api client
requests
Try this and And you should be good. No need for oauth.
Related
I am currently working on the development on a website for a client, and they want to display their Google Reviews in the footer. I am using PHP client libraries to so, and I've created OAuth2.0 credentials to access the API.
From the Google APIs documentation I see that I need to use the "Google My Business v4.9" API to do so, in order to use the accounts.locations.reviews. See the following screenshot to know the one I want to use :
The problem is when I want to activate this API on my Google Cloud projet, I can find all the Google My Business API, but not the "v4.9" (I've tryied searching for "my business", "google my business", "v4.9", etc... but I still can't find it. Here is what I get :
I've tried accessing the service without activating any API, thinking that maybe the v4.9 API was maybe activated by default, but I get 403 error saying "SERVICE NOT ENABLED".
Has anyone encountered this problem, and do you know which API to call ? any piece of information would be really appreciated !
Thanks in advance !
After searching a little bit more in the API documentation, I've found out that in order to have access to Google My Business API, you need to submit a form about your business so that Google authenthificates it.
Otherwise, the API will not be visible in the APIs library for your project.
See : https://developers.google.com/my-business/content/basic-setup#enable-the-api
The link to the form : https://docs.google.com/forms/d/e/1FAIpQLSfC_FKSWzbSae_5rOpgwFeIUzXUF1JCQnlsZM_gC1I2UHjA3w/viewform
With Facebook API V1 it was possible to publish event. With API V2 this is not possible anymore.
But Eventbrite still has this function.
How do they do it?
Looks like Facebook is doing V2 forced rollout in phases
Yes, according to Facebook, the process of switching all apps over to API v2 is expected to take a couple of weeks. This was stated in the Facebook Developers Group on Facebook, when they started the v1 to v2 migration.
or is treating Eventbrite preferentially.
No 3rd party app will get any special treatment – so even Eventbrite will not be able to create events via API any more, once their app is migrated to v2 as well.
This has also been stated by Facebook employees in the aforementioned group on multiple occasions. This topic has come up there frequently, also regarding f.e. removal of the ability to see all of a user’s friends or removal of the permission to access a user’s groups. People have been asking how “big players” like f.e. Hootsuite can still do those things, whereas their own apps that have been using API v2 already couldn’t – and the official answer has always been, those other apps are still using v1, but once they are migrated to v2 too, they will lose those abilities too, and there will be no special treatment or exceptions.
They are receiving special treatment from Facebook and they are using current API versions (or very near, 2.5 instead of 2.6 as of June 2016).
They keep repeating that statement ad infinitum: "No 3rd party app will get any special treatment" but it's simply not true. EventBrite is using v2.5 and V1 was phased out April last year?
You can definitely still publish facebook events directly from within EventBrite.
Facebook has a long standing record of setting double standards with regards to their API, regardless of what Zuckerberg might preach at F8 from his podium.
I got this response from Facebook - have not yet tried if this really works:
*Thank you for writing to us. We understand your reaction however please do try out sample permissions using Graph API and you would be able to understand which permission is producing the dialog you see with Everbrite.
For example the dialog you see as per stack overflow report is using the rsvp_event login permission that is available to all our developers.
https://developers.facebook.com/docs/facebook-login/permissions/ -> rsvp_event section will help you understand how you can request for one and what actions can be performed in terms of "managing your event"*
I want to be able to query the Gmail API through a HTTP GET request.
I'm trying to query the Gmail API to get a message unread count from my INBOX label.
API Reference : https://developers.google.com/gmail/api/v1/reference/users/labels/get
The API reference shows the following HTTP request to get the unread count.
GET https://www.googleapis.com/gmail/v1/users/userId/labels/id
The API reference also says you need authorization through OAuth 2.0.
I managed to get examples working in the PHP library to successfully query the API but there is not enough PHP documentation to write any specific code.
However the API reference lists all HTTP calls to access different parts of the API however I can't figure out how to use OAuth (Access Tokens) with these HTTP requests?
The official PHP client library comes with a few examples like this one that shows you how to authenticate using OAuth. The API documentation also has a lot of information about this process.
To get the unread messages count, you should do something like this:
// $googleClient is an authenticated instance of 'Google_Client'
$gmail = new \Google_Service_Gmail($googleClient);
$label = $gmail->users_labels->get('me', 'INBOX');
$unreadCount = $label->messagesUnread;
You might have to turn 'Conversation view' off in the Gmail settings for this to return an accurate result.
Accessing the Gmail API in php should be similar to other Google APIs from php. Maybe look at quickstart examples from the calendar or Google Drive APIs in PHP and work from there?
If you have the oauth2 access token you can often just put it in the "Authorization" header. c.f. https://www.rfc-editor.org/rfc/rfc6750#section-2.1
Though honestly, I think it'll be a lot easier long-term to figure out how to do it with the PHP Google APIs library...
I have signed a NDA with yodlee and i have got all the SDK files(java,jar and other related docs).
I am a PHP Programmer and from my understanding:
Yodlee is like an engine (almost like Twitter or Facebook) and we need to leverage the API to build different apps
The documents I have gone through is not with good-sufficient information.
They use SOAP-API and I need to use this API.
I have surfed the net for days, and finally posting a question here.
My Question is very simple
I have to register a user from my php-form to yodlee using soap-api -> Is this possible
If No, is it possible to login from my web-portal to yodlee and access the fin.apps.?
# 1 is possible. Other clients have done it. You just have to invoke the web services operations from php. We have php sample code.talk to the sales representative about getting access to sample apps plus Yodlee SDK developer forum.
# 2 is not possible.
In one page on my personal site, I like to be able to see some data get from Google Analytics.
I like to have a list of all my site and the average visitor per week or per month over the current year
I have check some solution:
Yahoo Pipe (look complicated)
Google Analytics PHP API class(look nice)
Google Analytics API (look official)
Dimension Analyzer for Google Analytics(look fancy)
So at this point, it have done my research, but none give me something i like to have. Getting a JSON from google would be nice. I will have to parse a XML maybe, but i like to see simpler solutions.
ANYthing would be nice too see
The current version of the Core Reporting API supports this.
You can use the PHP client to access the API. You'll need to register your project in the API console to obtain OAuth 2.0 client ID and secret.