okay so we successfully authenticated using OAuth authentication and now we
are ready to call REST API get methods retrieved data and then paginate through
the results and actually we already have the data after testing our or earth
connection so we got contacts has more and some kind of with offset column and
all the contacts are put in one row and to fix that we will have to go to
properties filter select filter and select the data we want and we want
contacts right so I'm selecting this contacts adding going back to trivia
hitting preview and voila we have more rows okay so now we are ready to
paginate through the results and to do that let's
go back to let's get back to documentation the same page which talks
about getting all the contacts the first thing we need to do is to find a
parameter which lets configure the maximum number of contacts we get in one
request so we are trying here to minimize the number of requests and we
see that the optional parameter count actually does that lets you specify the
amount of contacts to return so as you see in at least in this page
and in many other API providers the method will have the parameters and
there there are three type of parameters you might see in in the documentation
its header parameter then there is your L parameter rikku as it says here and
then there is body parameters so you should enter them and configure
accordingly so we see here the required parameter or auth access token and
actually if you took a look here we are not passing anything but since we have
earth connection manager under the hood when the request is being made it adds a
header and exactly this kind of had an authorization bearer and adds the token
so this parameter is taken care of and you should always pass all the required
parameters otherwise the request won't succeed and when you have URL as a
parameter I mean URL parameter you should go to
URL and if it's the first parameter you just enter a question mark and then
enter the parameter and its value if its second parameter use ampersand and then
use some kind of parameter again so I am wiping this and now we have 100 nobo we
will have 100 contacts returned for us ok so the next thing is pagination
so let's configure pagination and you should go you should look how to
paginate in the documentation as well so usually
there is some kind of section about pagination as a generic article which
suits for all the methods all the requests or or maybe it's present and
it's written something about in the same article so you find scroll here I would
see that this very weird column name we had with offset should be used as a next
as a parameter to get the next page so this vid offset is actually a reference
to the next contact in the next page so I will select this pagination option
select this option to and select the next link or course or expression and
now I'm selecting this with offset property so what it does basically it
retrieves this bit offset value and saves it in the next link holder
placeholder so now what I have to do is I have to to modify our URL slightly and
add another parameter and use this placeholder which holds the value to the
next contact in the page actually if this bit of some api's return and the
property with full URL to the next page so I would just have to use it like this
if if with offset was and URL but it's not so I'm pasting in here now I have
stop indicator attribute and you remember from our results there was this
has more so basically it's talked about if it's the last page or not so I'm
saying if it's the last page and the value is false like in this example as
more is false then it means it's the last page and I want it to stop okay
let's get back to preview let's make a preview
and we're kind of having the same results but basically it will page in it
but the problem I see now is that I don't see any emails and I have again
get back to the documentation and see where are those emails hidden so again I
can go back here in the documentation and look in the in the sample response
and find it that email is actually under identities property or I could use a
more fancy way and get this Fiddler's tool which is a web debugging tool and
lets you to see what other programs doing by that I mean what HTTP requests
they are making so be sure to have this option capture HTTP and decrypted space
traffic options checked because almost every request will be made to an API
will be secure okay so let's make this preview as you see we here we requesting
for a new token and here is the response ok bit slow ok
so in this part you see the request and in this part you see the response and
here is the sample JSON return not the sample I mean the actual the actual
contacts but it's not very nice to view so I will press this JSON tab go to
contacts and we'll try to look for email identity
profiles identities and I see that when the type is equal to email I will get my
email so now I will do the same thing here so I will use a selector and I will
select
my emails identities and I will select identities here the problem is here that
it will select all so let's let's make a preview and you will see the problem
again is that it also returns lead get which
we don't need so let's modify this this JSON path query and what I will do is I
will write this expression that when in the identity the type is equal Amahle I
want those records retrieved basically I want only those so I am escaping single
quote with double quote now previewing data again
and now only emails are present you can read more about JSON path when you press
this what's this link you will see examples
and different different JSON paths etc it's very simple like an XPath so if you
are acquainted with that it will be much it will be much easier for you to
understand okay so we are now ready to use this query in the excel key so I'm
pressing data from other sources from Microsoft query selecting the data
source I created selecting any table with any columns because I will be using
a query and here I am saying that I want to use the query
okay clicking that sequel button to open this window clicking paste clicking okay
okay
closing getting back fiddler sorry so that you could see how it works how the
pagination works basically and you see the pagination already started in it and
it simply adds the bid offset to the next link and it increases 100 hundred
at a time so you see this request let's say it has this vid offset as a response
like ten thousand eight five three and it and it is used in the next request
okay so we retrieved the data let's look to the right yeah I will hide these
columns hi these alright and I got my contacts all one thousand and something
okay so this sends data retrieval and pagination part and in the next part we
will cover the topic of how queries work and how to build them and use them in
applications