Instructor: So, let's use Beeceptor
and see how we can use it to simulate REST API.
So first, head to this URL, https://beeceptor.com.
So, this is Beeceptor's homepage.
You see here a short description
of what Beeceptor does and a large text box.
In this text box, you are going to choose the domain
that you are going to use to simulate the REST API.
It can be any name you would like,
so just pick a name and write it here.
I'll use here, apicourse and create endpoint.
Now you see this page.
In this page.
What you see, is the full URL of the server of the domain.
Your API will be residing, copy this URL,
we will use it later in this course.
And now, what we would like to do now is create
a test API to make sure everything is working fine.
Now REST API mocking in receptor
is defined using the mocking rules.
You can see it up here.
So, let's click mocking rules and create new rule.
And this is where things get really interesting.
So, what we do in this page is defining what is
the REST API that we want to mock?
Including its address, its verb,
its headers, its response, and the body.
So, let's define a REST API endpoint and see what happens.
So, first we are going to choose the method.
If you click this and opens the list,
then you can see here all the HTP verbs
we talked about, including some more
that we didn't talk about.
And we will go with GET.
Here, we are going to write the URL of the REST API.
So, let's call it api/test.
In this text box, we pick the status code
we want the API to return.
In this case, we will leave it as it is 200 meaning, okay.
And here, is the response body
or the contents of the response.
So in this text box,
we will define what will be the response
we will get from Beeceptor when calling the API.
So, let's just change this to success,
so that our test is success and click save rule.
So, this is our first REST API mocking
and let's see if it works.
Let's open another instance of the browser
and paste here the URL we picked before,
notice the domain name here.
This is a domain name that we selected
at the beginning when creating our account in Beeceptor.
And then, we'll just write what is written here,
the URL of our API.
So, this will be api/test.
Enter and you see here the body that we defined.
So, it looks that everything is working just fine.
We are going to use Beeceptor across this course
and you will find out,
it's very easy to use and very useful
for learning REST API.