In our next section we will talk about the rest.
AP ice
let's start with the API and firstly I want to talk about what an API is and why it is important API
stands for application programming interface.
And basically it is something that allows one piece of software to talk to another.
Now there is lots of different kind of API.
But when you hear people talk about Twitter's API or Google's API what they are talking about is an
arrest API which stands for representational state transfer.
Now it doesn't have to be the case but usually arrest the API works pretty much the same way a website
does.
You make a call from a client to a server and you get data back over the issue to be protocol OK.
Once you try to reach a web page for example simply what's going on is there is a P.C. in here and this
P.C. is sending some issue to be requests to the web server and the web server is responding back with
the extra tip your responses.
OK.
I think one of the best ways to show the many similarities between arrest API call and loading and normal
web page can be found with Facebook.
Graph API for example when you browse YouTube's Facebook page which is Facebook dot com slash YouTube
and you know we are all familiar with what our Facebook page looks like.
It shows how many legs that YouTube page has and things like that.
Now lets browse the graph that Facebook that comes slice here too.
And what we get back is a response to our API request.
This time we have made an API request in our browser to Facebook Graph API.
Now what we get back might appear to be gibberish to the human eye but it is actually javascript object
notation or Jason for meta data.
It is structured data organized according to key value pairs the same way an Excel spreadsheet is structured
with the key value pairs and you might ask for the data that is in cell.
You can ask a Jason array for the data if you want to know how many likes this Facebook page had for
the data contained on the key legs OK.
You can see it in here.
Yeah there is the how many likes that YouTube Facebook page has right now.
OK and a all modern programming languages some will be able to interpret these Jason responses so one
more concept I want to introduce the idea of parameters and now let's Bro's.
This web page graph Facebook dot com slash YouTube question Mark Fields equals to idea name and likes
in this page you can see that only IDI name and likes have been returned.
That is because these parameters have filtered the data that we get out of this response until now we
have only been consuming data from API.
But you can also write data to API.
For this purpose it would be good to know H2 teepee request methods which most importance are a CTP
post and a to b get a get request is what you use to consume to it and yet requests are used to read
three resource representation and information only and not to modify it any way as yet requests do not
change the state of the resource.
These are safe to be safe methods opposed through requests for writing data to API in the best practice
is to actually put the data in the body of the request.
Now let's focus on the networking again.
Let's have a look at how we are using rest api is on network automation Rest Api are not bound to API
s and they are used to communicate between an application and and network controller.
Specifically these APIs are using entity P for us to exchange information using Jason format typically
and we will talk about from Jason format on the next slides.
But there is an issue and that is there are several ETP verbs that we can use if we are creating an
API.
And if we want it to be easily supported we we should stick to some sort of standard.
So somebody else is gonna be able to look our API is and be able to support it.
So how can we have as standardized to approach to using these Asian dippy verbs in our API as guys for
those purpose we are using a module named crop which is used by software industry for the four primary
actions performed by an application and they are create reads Update and delight.
For instance if using the note bounds Rest Api of a DNA controller you might want to create something
new like and new security policy from a programming perspective.
The security policy exists as a related set of configuration settings on the DNA controller internally
represented by variables to do that arrest client application would use a create action using the DNA
center RESTful API that created variables on the DNA controller via the DNA center REST API.
The concept of creating new configuration at the controller is performed via the api using a create
action per the corrupt generic acronym and such that if you want to read something from the controller
we can use the get verb if you want to update an existing record on the controller you can use put verb
and if you want to delay that error.
You can use the delayed s to keep your.