in today's video i'll be showing the
quickest and easiest way to start using
github rest api this api allows you to
retrieve all sorts of data regarding
your github account
to begin go ahead and go to this url
that have my address bar i'll make sure
to also include a link in the
description or you can go ahead and just
google github rest api once you've done
that you should see a screen similar to
this or a page i'll go ahead and click
on guides and here click the very first
option it says getting started with the
rest api
and once you're on this page you can see
that this briefly goes over how the api
works and then go ahead and scroll down
until you see this curl command and then
go ahead and copy the api call here and
in this example i'll be using postman to
make these api calls just because i
think it'll be the easiest to follow
along with so to begin go ahead and
download postman if you haven't already
and once you successfully download
postman go ahead and open it you should
see a screen very similar to this and
for the first thing make sure over here
in the top left it says get because
we're going to be making a get api call
and afterwards go ahead and paste the
api call that we copied from the github
documentation
but for the very last part of the api
call go ahead and replace it with your
github username so i'll go ahead and do
that and once you've done that go ahead
and click send and now you should see
data back from the github api call and
if everything has gone right you should
see something very similar to what i'm
seeing and now you successfully made
your very first github api call
and so this cost specifically just
retrieves all the public github
information about your ghetto profile so
if you scroll down you should start
seeing like all these like urls relating
to like your github followers the people
you follow and etc and also things like
you know your the number of public
reports you have and so this uh github
api call is very useful if you're just
trying to retrieve public information
about anyone's github profile however
you probably notice that this just gives
you only the public information about
your github profile so for example it
just shows just the number of public
groupers you have however if you have
private repos as well uh it's not going
to show that so you might be wondering
if there's a way to do that and there
actually is a way if we go back to the
documentation and we click on the
authentication over here on the right
hand side um it'll actually show us how
we can generate something called a
personal access token and this will
allow us to get back a more detailed
response from the github api as we would
be active as an authenticated user so in
order to generate a personal access
token go ahead and log into your github
account once you're on a get up homepage
go ahead and click on the top right of
your profile icon and go ahead and click
settings once you're in settings go
ahead and scroll down to developer
settings and then click the tab that
says personal access token and here we
can generate all the personal access
tokens that we need so go ahead and
click the button that says generate new
token and here
you can see all the details surrounding
the personal access token we're going to
create so the very first thing is just a
name so i'll go ahead and just name it
like postman api calls
and here the expiration you can go ahead
and set it to whatever you would like
i'm just going to do seven days for this
example so on september 21st this will
expire and will no longer work uh once
the seven days is up
and then for the next section you can go
ahead and select the scopes or the type
of data that you'll allow this
personal access token to make so in this
example i'm just going to select repo
however if you want to select this other
types of data you can go ahead and do
that and once you're done go ahead and
click generate token
and now once you successfully generate
your own token you should see the screen
box go ahead and copy this personal
access token because once you uh close
out the screen you won't be able to
access again
so now we successfully generate a
personal access token the next api call
we'll be making will be to show all the
repos that we currently have for our
github user even if they're private so
we can go ahead and start looking for
the documentation by going back to the
github rest api documentation and on the
left hand side we will see an option
that says references go ahead and scroll
down and then click on repositories
and just let it load and once it's done
loading we can then uh just like look
through the documentation just to list
out all the repositories for
authenticated users so if we go on the
right hand side there is an option that
says list repositories for the
authenticated user and so this will be
the api call that we're going to make
so here you can go ahead and read more
details about it but i'm going to go
ahead and go back to postman and here go
ahead and just copy and paste this
api call into the box for postman and
make sure it says get because we're
still making a get request however in
authorization tab go ahead and change it
from
i believe will be inherit auth from
parent but go ahead and change it to
bearer token and once you've done that
there's a spot for you to input a token
and go ahead and paste the uh generated
token that we got from the previous step
uh just like i've done so here
and once you've done that go ahead and
click send and now if you've done
everything successfully you should see a
screen very similar to mine you should
get a response back from the server and
if you remember from earlier i had two
public repos so if we scroll down um you
can see this is my first public repo
like the hello world repo and if i
scroll down to my second repo this is
like the github website uh i had so
that's my second repo however if we
scroll down some more you'll now see a
third repo uh which is like something
that is called my private repo and i
probably marked as private and so this
did not show up in the previous api call
because that was only for public uh
github data however now they're using a
personal access token now i can access
like more detailed uh data about my own
github account so this is my quick
tutorial on how to start using the
github rest api if you want to make
other kinds of github api calls go ahead
and just look through the documentation
and you can find
lots of different github data that
you're able to access so if this video
helped you in any way please like the
video and don't forget to subscribe