JOSE ALCERRECA: Welcome to this video about the access
management API.
I'm Jose Alcerreca, and I'm here with Nick Johnson.
NICK JOHNSON: Hi.
I am machine that turns copy into code.
And I write the AdSense app for iPhone here at Google.
JOSE ALCERRECA: Thanks for coming, Nick.
First of all, can you show us a demo of the app?
NICK JOHNSON: Sure.
So if we start here on the overview page
that you'll see when you open the app,
you have key values for the important time
spans with deltas against appropriate comparisons.
Tap one of these and go through, see other important metrics
for the same time period, as well as a graph.
Tapping the other metrics, you can
see those displayed as well.
If we put this in landscape you can swipe again and also
hold a single simulated, in this case,
finger down to examine a value, or two fingers
if you want to compare two values.
So if I go back to the side menu here,
you can see we also have the majority
of the reports from the AdSense homepage.
So if I select one of these entirely at random--
I'll go with countries-- you can see a bar graph
of your performance across different countries.
We can go into landscape to examine a value.
Or if you want to see this data as a pie chart, just swipe this
and you get a nice transformation.
JOSE ALCERRECA: Wow.
NICK JOHNSON: Thank you.
Yeah.
Here, you can tap for a landscape
to go through the same thing.
JOSE ALCERRECA: Great.
OK.
So you're obviously using the AdSense Management API.
But are you using the Google Client Libraries for this?
NICK JOHNSON: Yes.
I'm using the Google Client Library
for Objective C for all of the requests.
JOSE ALCERRECA: OK.
And I know for each page you just use one request
or you just make one request.
NICK JOHNSON: Yes.
That's correct.
JOSE ALCERRECA: How do you do that?
NICK JOHNSON: Well, actually, as an example,
if we go back to the overview here, what you could do is
you could request this entire time span as individual days
and then I add all the numbers together.
But you don't want to do that, because you
can suffer rounding errors.
The API will only return you with accuracy down to the cent
or down to the penny, in this case.
So you want to use the total of each report
for each one of these values.
So that's a total of eight values.
What we do is we collect all these together
into a batch, which allows us to basically take
a list of requests and get a list of responses back.
Objective C Client Library has support
for several different kinds of call backs.
And in Objective C, you can use something
called a block, which is essentially a closure.
So every single value that comes back, our call back gets
called, updates the data.
And then the batch query has a nice feature
where you can set an additional block
to be called right at the end, which then updates the display.
JOSE ALCERRECA: Great.
Are you also using the cache layer?
NICK JOHNSON: Yes.
Another benefit of using adjacent API
is that each request and response
is essentially a string-- so a very simple key value cache.
JOSE ALCERRECA: You actually store the response?
NICK JOHNSON: Yes.
JOSE ALCERRECA: OK.
That's cool.
All right.
So when developers start coding for the management
API for any APIs at Google, they have to readjust to the project
first.
For iOS, what are the options?
Because you have install application, web application.
NICK JOHNSON: It's the web application and service
count on option.
And you have to go with an installed application.
Just a regular other installed application
will work just fine.
But for extra security, you can use the iOS specific option
that's available there as well.
JOSE ALCERRECA: OK.
Great.
And what about performance?
Do you have to do anything special to imporve it?
NICK JOHNSON: Batching is the main thing.
An improved performance means you
don't have to worry so much about synchronization.
And happily, just about everything else we
need is provided by the Client Library
by Core Animation in iOS itself and excellent open source
library called NimbusKit, which we use.
JOSE ALCERRECA: OK.
That's great.
OK.
Thank you very much for your time, Nick,
and congrats on an awesome job.
NICK JOHNSON: Thank you very much.
JOSE ALCERRECA: OK.
See you later.