Welcome back.
And this video, I would like to show you some tools that we are going to use for the next few videos,
which will be super helpful when it comes to using API calls to websites which have chasten.
So we are going to use Moqui in order to create our own.
Jason.
Response or our own HTP responses, which contain JSON data that we can then use in order to displayed
in our application, and that can be something like whether that can be something like the latest results
of a sports event or in general data that you find on the Web that is stored in a clean manner.
So most of the time it's stored in Jason formate or it is stored in XML format.
So these are the most common ones.
And Jason is really the one also, for example, used at Firebase.
So it's going to be super useful to understand what we're going to do in the next few videos.
All right.
So we are going to use Moqui in order to make our responses to test our API calls.
So we're going to, so to speak, fake an API website, so to speak, which we then can go ahead and
use in order to test the whole Drayson thing, which then will allow us to apply those same principles
to other rest APIs.
By the way, Reston's stands for Representational State Transfer, and it's an approach to pretty much
allow the requesting system to access and manipulate text representations by using a uniform predefined
set of stateless operations.
OK, so we can just send some HTP methods, for example, get had, post put and so forth, and then
we get a response based on what we have sent.
So the ones that we're going to use is get and post this video.
So get is when you get data from a website and post is when you send data to a website.
So that would be something, for example, when you want to log in.
So when you create an application where the user has to log in, you send a post request with the login
information of the user.
And if you want to get, for example, the weather data, then you would use to get requests, so let's
generate our customer response.
So here you can see there are studies that we can select.
For example, there are plenty of them.
So the ones that we're going to use is two hundred, OK, because that's the one that just says, OK,
everything went fine and you can basically get the data, but otherwise you can of course, see there
are plenty of different response codes.
For example, for 04 is not found.
You probably have seen that one before, but then everything with a four has something to do with a
bad response and then to has usually something to do with a good response.
So we're going to use the two hundred.
If you want to know more about the status codes, I would recommend to just look up a whole definition
of all the different status codes if you really care.
But most of the times that will just be that you get a status code and then you can read about it what
it does and react accordingly.
So, for example, if there is no connection, then you might want to let the user know that there is
no connection and displayed on the screen.
All right.
So I have a very basic chasten object that I created here.
And you can see it starts with the curly brackets.
So you need to open adjacent object and close and just an object with curly brackets.
And what I have here is the key value pair of ID and the value of one.
And they are connected by the colon, as you can see here.
And then you need to add a comma in order to separate them.
So now it knows, OK, this is the first entry and this is going to be the second entry.
Now, if you want to go ahead and test it, you can generate your own HGP response by clicking on this
button and then you will get that link.
So let's open that link.
So you can see generated this very clean website, which just has our Jason object here, so I cannot
copy that and go to the Jason viewer and now paste that in here and then view that and the viewer so
you can see it's a Jason object which has two entries, the ID and the name.
And on the right hand side, you can see how it would look like in a table.
All right.
So we have the name ID and value of one then with the name of name and the value of Dennis.
All right, so this is a super simple Jason object.
Let's look at a more complicated one.
For example, this one here, so I prepared something which is a little more complicated, so you can
see it has a message and a user I.D., the name, email, mobile profile details.
As you can see, profile details itself is also adjacent object.
So it has another key value pair is profile completed is set to true.
The rating, four point seven.
And then we even have a list here.
So you can see when you want to use this, you can use curly brackets, but then each list entries again,
adjacent object in this case.
OK, so let's use that and look that up in our Jason viewer.
So here.
Let's review that and you can see that this Chazen object is a lot more complicated, so now we have
this message which says you have successfully logged in the user I.D., the name, the email and so
forth.
And you can see here on the right hand side, that's how the data will be displayed.
So data list, for example, is a dot, dot, dot, which means that it contains multiple entries.
So this is a list that we have here with three JSON objects, which are ID and value.
And then the profile details his adjacent object itself, so you can see you can have JSON objects within
Jasen objects, but you can also have lists within JSON objects which contain jasen objects.
All right.
So it can be many different combinations and conservation's and that will be super helpful once we get
over to using real data, because that's the format in which we get data quite often.
So it's not just going to be adjacent object, which only contains data in the highest level, but it
also has other JSON objects, which will also be important to read correctly.
All right, so this was just a little introduction to Jason, and it will make a lot more sense once
we get some more examples and we built our own code, which then will try to access this file here and
then read it and then make Jason objects of it, which we then can use.
So we're going to see two ways to do that.
One is the traditional way, which is rather cumbersome, and then one where we will use a third party
library, which is called Jaeson, so not Jasen, but with a G, and that one is super useful and powerful.
We're going to see how to use that.
And then later on, we will use another tool which will allow us to get to HTP requests much quicker
instead of using this super long code that we will see in the next video.
All right.
So let's start with that in the next video where we will see the, let's say, default approach, where
you don't use any third party libraries and you will see why it's useful to have something else that
will help us with that.
So a third party library which will help us with that.
All right.
So see you in the next one.