Are you in the process of developing an application designed to incorporate one or more of the Google APIs? Do you already have an application and want to add Google data to it? Are you having problems understating where to start? I am going to try to give you some tips on where and how to get started.
[wp_ad_camp_3]
This article is going to be very short but it is going to spawn four five more posts that will continue to walk you though becoming a Google Developer.
Google APIs
Google has an extensive list of APIs that they have released for public use. Most of the APIs are free Google does not charge us to access the APIs. However there are a few of the Google APIs that you do have to pay to access or pay to access more then the default number of requests. You should always check into the quota of the API to find out how many request you are allowed to make before you may have to start paying for the privilege of using the API. Google will not charge you unless you accept the billing terms so don’t worry you aren’t going to suddenly start getting a bill from google if you go over the number of request.
You can find a list of all of the APIs here. Google APIs Explorer
What is quota?
Quota is how many requests you are allowed to make to a Google API without requesting permission to access more. Most of the Google APIs have a free quota, a number of requests Google lets you make without asking for permission to make more request. It does not always cost you anything to extend your quota it depends upon the API if you are going to have to pay for permission to make additional requests
Unless it says, otherwise APIs Quotas are projects based not user based.
Each API has different quotas I encourage you to check the API you are using for information about the quota it has available the following examples are from the YouTube API.
Project quota example
50,000,000 units/day
If I authenticate the application and make 10,000,000 requests, then you authenticate the application and make 40,000,000 requests the quota limit will have been reached and any additional request will result in the following error.
dailyLimitExceeded A daily quota limit for the API has been reached.
You will have to wait until midnight Pacific Standard Time(PST) before you can make more requests.
Google project Quotas reset at midnight Pacific Standard Time(PST) this is the west coast USA timezone.
Personally I think it would have been more logical to reset it at GMT time but Google is located in the PST time zone so maybe it’s easier for them to understand.
User quota example
Per-user limit 3,000 requests/second/user
Some Quotas are user based, a user is normally the person that has authenticate the request so it is hard to understand how it comes into play with a public API key but it does. Every request sent to google contains information about who is making the request in the form of the IP address where the address came from. If you have, your code running on a server the IP address is the same all the time so google sees it as the same user. You can get around his by adding Quotauser to your request this will identify the request based upon different users.
If you send to many requests to fast from the same user you will see the following error.
userRateLimitExceeded The request failed because a per-user rate limit has been reached.
The best way to get around this is to use QuotaUser in all of your requests, and identify different users to Google.
Authentication
[wp_ad_camp_1]Depending upon which Google API you are interested in you may need to be authenticated to access the data. In some cases, the different methods within an API may have different authentication requirements.
For example: The YouTube API allows you to get a list of all videos without authentication but to insert a video you must be authenticated. That is because list videos gets a list can get a list of public videos while inserting must be into a user’s account you need the permission of the user to upload a video to their account.
So there are two types of data we can access with the Google APIs they are public and private. Private data is data that is owned by a user, my GMail account is private my files on Google drive are also private, if you want to access them you have to have my permission to get my permission I must authenticate your application and grant you permission.
Public data is data that is accessible by anyone, if I upload a video to YouTube and set it to public anyone can see it without being logged into Google .
You should check the documentation for the method you are using to find out if it requires authentication or not. If you see the following, you will know that you need to be authenticated to access this information.
This request requires authorization with at least one of the following scopes.
What are scopes?
I will be talking about scopes more in the Oauth2 section of this blog series. Scopes are a way of telling the user, what access you need. When you request access from the user you can tell them I need to be able to write to your YouTube account, or I just need to view your YouTube account.
Creating a project
In order to use Googles APIs you must first register your project on Google Developer console. This is so that Google can keep track of the Quota of how much you are using it. It also helps them to prevent attacks if they know who is making the request they can shut down the account before it causes any problems with their servers. We will be looking at how to do this in the next five articles.
Client Libraries
Google has created a number of client libraries for accessing their APIs to my knowledge they are all open source projects so you are welcome to help. If you can, I encourage you to use the client libraries I have used a number of them and find that they save me a lot of time. You can find a list of the Google client libraries here.
All of the requests to Googles APIs are simple HTTP POSTS or HTTP GETs so you do not need to use a client library if you are willing to code it from the ground up yourself.
Conclusion
Google has a large number of APIs that they let us use to access data on their servers. We must create a project on Google developer console before we can begin accessing data on Google servers. Google has created a number of client libraries that make it easier for us to access data though the Google APIs.
Join me for the next post in this series how to create a project on Google Developer console.
Hi Linda, Do you provided paid consulting advice? I’m a software developer and have a module in my application that uses the geocode API. It is currently working well but with the key provided by the programmer. I’ve been going round in circles through Google web sites and Stackoverflow trying to, firstly, open a Google Developers account to get a developer’s key for myself to extend the use of the geocoding API in a PowerBuilder client server application and, thereafter, to set up user accounts for the API for clients who use my application. Your site is very informative but I can’t find a way to get to even first base and open a developer’s account. If you do not consult, can you refer me to someone who could assist?
Yes I offer a consulting service. Feel free to contact me I would be happy to help out any way I can. Consulting service form
Hello,
Please hope you have a time to tell me how i can do by c# with vs2013 :
In my program, i give the long URL like below
https://www.google.ca/maps/place/2245+Rue+Decelles,+Saint-Laurent,+QC+H4M+1B8/@45.5049902,-73.6933519,17z/data=!4m2!3m1!1s0x4cc9181753a58a3f:0x8b27da5c16002cf5
and i have to to get shortURl like this :https://goo.gl/maps/qT4rodgyhBk
Sorry my english. Thanks for your time.
Nicolas
Your English is very good 🙂
Here is an example for you. Google Url Shortener with C# I hope it helps.
Hi,
I am trying to insert mail having attachment of size more than 5 mb using Google API.
It is throwing exception : An Error occurred, but the error response could not be deserialized.
I have raised same question on http://stackoverflow.com/questions/38434260/exception-while-inserting-mail-having-attachment-as-a-pdf-of-size-more-than-5mb
http://stackoverflow.com/questions/38450127/c-sharp-upload-attachment-using-google-apis-gmail-v1-usersresource-messagesresou
Please suggest solution.
Thank you.
I have responded to your question on stack its really the best place to ask that.
I tried this:
string f_readLines = System.IO.File.ReadAllText(@p_EMLPath);
f_bytes = System.Text.Encoding.UTF8.GetBytes(f_readLines);
f_MsgRawStr = Convert.ToBase64String(f_bytes).Replace(‘+’, ‘-‘).Replace(‘/’, ‘_’).Replace(“=”, “”);
Message f_message = new Message();
f_message.Raw = f_MsgRawStr;
f_message.LabelIds = “INBOX”;
Google.Apis.Gmail.v1.UsersResource.MessagesResource.InsertRequest f_ReqforMail = m_MailService.Users.Messages.Insert(f_message, “me”);
f_ReqforMail.Execute();
Still same exception.
Please suggest solution to insert mail having attachments of size more than 5mb.
Hi, Can I reblog this post on my blog?
You are welcome to link it but i would appreciate you not re-blog it. Re-blogging will take away from my site and google deducts you with regard to SEO if you are copying content.
That’s why I wanted to take permission. I will link it now.
Hi Linda
I’m experimenting for the first time with the Google Sheets API (v4) in C#
I’ve been through the quick start sample, and set values in a Google sheet. I’ve now moved on to trying to update cell formats.
I’ve had some success, but it’s not complete! I am fairly confused by the ‘fields’ field (or FieldMask) of the UpdateCellsRequest.
I am trying to change the background colour of a range of cells. If I specify “*”, the update (always) seems to work, but wipes out the cell value in the process. If I specify “UserEnteredValue(BackgroundColor)” it seems to work once when I first run my program. If I change the capitalisation e.g. userEnteredFormat, it never works, but doesn’t complain. If I enter some gibberish like “UserEnteredFromage” then I get an exception (fair enough, I’d expect that!)
But how can I edit the background colour without wiping out the cell’s value?
(It also resets/defaults/”wipes out” other aspects of format, e.g. font, alignment, border)
I’m not familiar with Google Scripts, Node.js, PHP, Python or Ruby, just C#,…so the Google Sheets API documentation which seem to be mostly written for these other languages are a little hard to follow sometimes. For FieldMask on the UpdateCellsRequest page, the link seems to take me to something in the Protocol Buffers API documentation, which I don’t think is right.
Can you help? – Many thanks!
Dear Linda Lawton,
I am writing you a comment since I saw that you are expert with Google Apis and I am stuck at one specific question with Google indexing batch request.
I wrote the question in details and the things I’ve tried in stackOverflow (https://stackoverflow.com/q/54337324/1841839). I would like to know, if could you please read my post and give me some advice about what’s going on with my issue. I am new babies to work with Google Apis.
Thanks in advance and sorry for disturb.
Kind regards,
Jing
Hi Linda
Thank you very much for your hard work trying to make our day easier!
I’m experimenting for the first time with the Google Sheets API (v4) in Java, basically I have a web application where the end user has to complete a form, the data of that form is sent to my web app and my web app try to save it in a Google spreadsheet. The application owner has the possibility to configure the ID of the spreadsheet where he wishes to save the information. The owner does not have to consent to the access, I mean, I need that my web app does not consult the owner if he authorizes access or not, my web app must negotiate the authorization directly with google , so my question is what type of credential do I need to use? I’m trying with a service account but I get an error related to the GoogleClientSecrets object (java.lang.IllegalArgumentException in com.google.common.base.Preconditions.checkArgument (…..) Basically that object does not have the parent Json object “installed” or “web”. But my json service account doesn’t have it, so I think I’m using an invalid authentication flow.
Here my code to get the credentials object
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
netHttpTransport, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(new MemoryDataStoreFactory())
.setAccessType(“offline”).build();
return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize(“user”);
and the credential json looks like
{
“type”: “service_account”,
“project_id”: “quickstart-XXXXXX”,
“private_key_id”: “zzz”,
“private_key”: “boo”,
“client_email”: “foo”,
“client_id”: “xyy”,
“auth_uri”: “https://accounts.google.com/o/oauth2/auth”,
“token_uri”: “https://oauth2.googleapis.com/token”,
“auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”,
“client_x509_cert_url”: “xyz”
}
Thanks in advance
If you pop your question up on I would be happy to have a look at your code