►
From YouTube: Extras: Getting started with APIs with Jonathan Moss
Description
We had a lot of extra content from Jonathan Moss's talk on getting started with APIs, so we will be clipping it up and adding an extra few videos like this one where he discussed PSTenable.
If you want to watch the original talk on APIs:
https://youtu.be/ZbpbissNlCs
A
A
A
Is
all
this
was
possible?
Basically,
here's
how
you
connect
to
PSN
able.
So
what
happens
here
in
this
line
is
I
read
a
wrapper
around
and
the
rest
method
that
will
log
you
in
that
the
dashed
register
switch
actually
caches,
the
token
that
you
need,
and
then
every
single
other
call
just
uses
an
existing
token,
so
Stephen.
The
question
you
had
is
authorization
pair.
A
Let
me
show
what
I'm
doing
so
connect
PS
enable
is
a
is
the
initial
function
that
you
run
again
this
information
and
then
let
me
show
you,
my
private
function
that
I'm
using
so
I
actually
wrote
a
private
function
called
invoke.
Ps
inable
rest
is
actually
a
wrapper
around
a
book
rest
method
and
what
it
does
is
actually
build.
The
parameters
that
you
need
every
time,
instead
of
having
to
put
all
that
crap
in
every
single
call.
A
So
basically
what
I'm
doing
here
is
I'm
building
my
rest
method
with
different
values
right,
so
my
headers
will
always
be
what's
required
to
query
this
API
and
then
my
web
session
is
web
session.
Is
my
cookie
that
I
can
use
to
continue
making
calls
and
then,
if
I
want
to
pass
in
the
body,
here's
my
e
ball
and
here's
how
I
request
it.
So
if
I
go
to
example,
I
thought.
B
A
A
A
So
what
I
do
in
every
public
call?
Is
this
in
the
begin
block
I
put
token
I
put
this
code
so
invoke
PS
simple
token
status
will
return,
so
connect
spree
goes
true
or
false.
Then,
if
it's
true,
as
in
my
token
expired,
I'll
call
a
function,
induct,
animal
token
renewal
and
those
are
rappers
around
and
book
rest
method.
So
if
I
come
here,
this
is
my
status
right,
so
I'm,
basically
I'm
submitting
a
call
to
an
endpoint
token
and
that
token
is
essentially
returning
a
specific
response.
There's
specific
property.
A
So
if
this
release
session
is
true,
then
I'm
not
putting
true
else
false.
So
if,
for
some
reason,
is
false
I
just
do
it
about
PS
enable
token
renewal,
which
will
give
me
a
new
token
and
then,
in
this
case,
I'm
using
PowerShell
framework
to
store
the
token
in
a
in
a
variable
and
then
yeah
that
that
overrides
it
at
each
time
so
Jason
Steven,
do
you
guys
have
questions
around
that?
A
B
A
This
is
a
module
created
by
what
was
his
name
yeah
Friedrich,
Wineman,
MVP
and
Mike
I
know
Microsoft
PFE
and
he
I
got
into
his
stuff
a
lot
of
fun,
so
he
has
PS
framework
as
a
there's,
a
lot
of
advanced
coding,
and
he
has
a
lot
of
different
videos
on
this
as
well.
So
my
but
I
used
this
his
stuff
for
us
just
you
store
the
tokens
in
configuration
using
his
method.
A
So
if
you
could
share
it,
thanks
is
that
copy
is
parish
longer
the
update
team
stats
working
at
you
so
much,
there's
a
ton
on
taste
and
bear
in
there
Andy
cool
watching
parish,
yeah
awesome,
it's
midnight!
Thank
you.
Andy
for
joining.
That's
awesome.
I
have
an
example
around
a
bear
took
it.
If
you
want
me
to
send
you
a
link,
yeah
sure
go
for
it.
Yeah.
A
A
B
Haven't
we
have
an
API
and
I've
been
working
on
writing
a
wrapper
for
our
API.
Like
some
of
the
examples
I
showed,
we
have
an
analytics
website
that
we
publish
to
our
customers
and
it
uses
bearer
token
authentication.
So
this
is
my
connect.
The
analytics
wrapper
that
uses
we
effects
the
PS
credential
object
to
take
those
credentials,
and
then
it
actually
passes
that
as
the
body
of
the
name
and
the
credential
as
the
body
into
my
broth
methods
in
both
the
request,
what
it
gets
back
is
a
result.
B
You
know
header
and
when,
when
we're
doing
that
it,
it
actually
sets
as
part
of
the
invoke
the
a
rest
requested.
That's
this
script
level
variable
of
the
header,
so
I
could
just
grab
that
real,
quick
in
the
bodies,
authorization
and
all
I
have
to
do
is
really
build
it.
So
you
just
take
the
bearer
and
then
essentially
I
format
it
into
a
way
where
it's
you
know,
I
take
the
result,
and
then
the
body
piece
and
I
just
kind
of
stitch
it
together.
B
Quickly,
when
you
are
looking
for
a
bearer
token,
so
we
have
to
use
the
open,
API
spec
for
this
documentation.
This
is
going
to
talk
about
the
you
know
how
you
send
it
across
and
then
this
is
the
response.
So
the
response
in
JSON
is
actually
the
type
bearer
and
then
the
tokens
you
could
actually
get
the
bearer
piece
and
the
actual
token
piece
all
from
the
data
that
gets
returned
to
you
and
then
stitch
that
together
into
into
your
header.
B
So
that's
that's
kind
of
what
I'm
doing
here
is
I'm,
adding
that
into
the
global
headers
that
we
use.
You
know,
Johnson
was
talking
about
how
he
you
know,
builds
out
all
the
time.
So
all
the
you
know
template
data
that
you
need
to
send
every
time
like,
that's
all
in
there.
What
I'm
doing
is
similar,
where
I'm,
adding
that
bearer
tokens
that
bearer
tokens
then
get
sent
every
time
after.