so in previous video we covered how to call a REST API get method get the
results and paginate through them and in this video we will see how queries work
and how to build queries based on data source and then use those queries in
applications so let's say you're using your contacts in Excel you are
retrieving those and one day you find out that you also want your deals to be
loaded into an excel sheet and then you think well maybe I will just create
another data source we'll name it deals and I will use it in the excel but
then you start thinking okay I have I have those contacts I have deals
maybe then in the future I will have products and then maybe company names
and maybe and and you know that the list will grow and grow and grow and grow and
you start thinking maybe that's not what I really want maybe I want to have a
single data source name which would be responsible only for authentication and
that I could configure all the rest in the query itself right here right so
this is basically where query builder comes into play so let's click it it
shows up if I as you see this is a very very simple query right if I click
execute it will get me the same contacts right so that's how basically that's how
queries work so it takes the query it takes the configuration from this
property step and everything you override with with claws
will be overridden so so basically with claws is optional so okay we are ready
now to bring the the deals page and I will show you how it works so let's say
you'll find the link what's the end point to get the deals right you cop it
and you paste it here in the URL and you
let me make it wider we also are interested in the deal name so that deal
name would be returned as well and we also want to limit to limit this to
limit the deals return to one but I'm doing this only to show you that how
pagination will work for deals because it will be different so ideally you
would want to use some maximum number API allows as you see here limit I
maximum 250 so you would want to use here 250 but I am using just one ok just
copying this and that's execute okay we got an error that's perfectly normal
because if we went to properties we would see that there is this filter and
probably the data that is returned by deals endpoint is a bit different so I
will just remove this go back to preview and preview data again and voila we have
deals there are all put into this one row but
there is only one deal here and because of that has more column became true and
there is this offset column to reference the next deal so basically you see now
how this with clause with the source option overridden gets you a different
kind of result even here you have configured contacts okay so now we are
ready to to move on with getting deals so I will write here deals because I
have column here as deals meaning JSON property deals is here and that means
that I can execute it and get that one deal and while a super duper deal I
could have also overridden filter and written it like this and I would also
get the same result okay okay let me copy this again let's
get back to query builder I need to paste in here it again and now we need
to override pagination because pagination works differently for the
deals instead of with offset you have to pass offset parameter so that that's
what I will do I will go to pagination and I will now select this property as
you see it has changed to offset so I'm changing in here has more also has
changed and no more the dash is present I'm clicking okay and instead of with
offset I am entering offset be sure to you name the parameters as they are in
the documentation because sometimes they may be case sensitive so if it's
lowercase here let's put it lowercase here okay so that's it for the
pagination yeah one thing I forgot to mention in the previous video was
throttling so you may use throttling as well if your API will throttle you on
the number of requests you can make in the period of time and usually they do
so always refer to your API documentation and if we went here to the
get all deals you would see this question rate limited yes I press it and
I get all the limits this API has put on my requests so you may enter you may
configure it here in the query if it's if the API of the provider you use I
mean api's we have different kind of throttling options or limits so we can
put in here but if it's the same throttling for all the api's then put it
in the properties tab here okay pressing ok the query is generated I press the
preview data again and as you see instead of one row now I get all the
deals from here except I need to put the table name deals and voila
super duper deal is here ok so what I have to do now is just copy this query
bring back my excel
click data and now let me show you how to do it in a bit different way new
query from other sources from ODBC I select my jason driver connection oh and
one more thing yeah I'm copying this again and I need
to save my data source and now I click advanced option paste my query click OK
click load and voila super duper deal normal deal win-win
deal same as here are loaded so that's how you build queries and use them to
retrieve data from different URLs using the same or auth credentials in the next
video we will cover the topic of how to post data to an API thanks for watching