We're all done with our update root handler.
We've now got a lot of different routes inside of here and we've got some tests for each of them.
But before we just say that everything is really complete I think could be kind of nice to test everything
out using postmen to make sure that we can reach into this ticket service create a ticket updated ticket
and so on.
So we're going to use postman in this video to test out these different route handlers before we can
however remember we have to expose access to this ticket service.
We have not updated our ingress engine X config file and told it to take requests to API slash tickets
and forward them onto our ticket service trying to find my info directory inside there I'll find Kate's
ingress SRB.
So here's our ingress config file.
I'm gonna go down to our paths section and right after the API users path I'm going to add in a new
path so we'll say any request to API slash tickets slash anything take the request and forward it onto
this back end.
I want to send it to the service with the name of tickets SRB and a service port of three thousand.
Now once again it's super important that we add in this new path right here before the reactor the next
JFK route handler or at real setting right here.
This is a catch all route so if we put that at the top every single incoming request is always going
to match that one first and we'll never get onto API users or API tickets.
All right I'm going to save this file and then going to open up post man on my look machine.
So here's postman right here and we're going to try to test out the different route handlers we've just
put together to access all them.
Remember we do have to be authenticated.
The first thing I'm going to do is make a request to attempt to either sign in or sign up we'll do a
post request to H2 G.P.S. ticketing Dev API users sign in.
I'll go to Body select raw make sure I've got Jason selected over here and I could put in an email and
password and remember if you're going to make a request to sign in the email password must be some combination
that is valid that you've already created an account for on the off service.
So if you do not remember any credentials you can always change it over to sign up and make a request
to sign up at the email and password instead.
Either way whether you sign up or sign in make sure you make that request and get a response back.
As long as we see a response back that means we should now be authenticated just to confirm that we
could open up a second tab make a get request to ticketing Dev API users current user and if we send
that in we should see yes we are authenticated.
All right.
So now that I am authenticated First I am going to do is attempt to create a new ticket so I'll open
up a third tab.
I'm gonna make a post request to HTC P.S. ticketing Dev API tickets under the header section.
I'm gonna put in a content type of application Jason will then go to the body tab select raw make sure
I've got Jason selected and I will enter in the attributes or parameters body parameters that required
to create a ticket which you'll recall is a title and a price.
Don't put in a title
concerts
add a price of 10 remember that we are writing Jason on here.
So the key is after you wrapped in double quotes and the word concert has to have double quotes as well.
Then send this in and I should see a response that looks like this right here.
I should have a status of two a one created and I should see the title.
The price my user I.D. because on the person who owns this ticket and my I.D. for the ticket right there
as well.
Yeah well that definitely looks good.
Now if we take that I.D. or copy it and I'm going to try to make a get request to API tickets flash
and then that I.D.
I'll then send that off and there we go.
Requests made successfully status to 100 and I see all the details about that particular ticket.
Let's try an official list of all of our tickets to do so we can delete that idea at the very end and
make a request to just API slash tickets so I'll send that off and I should get back in array of all
the different tickets that have been created in my case.
I have to write here because I created one just before this video to test this out make sure everything
was working correctly so you're probably going to see an array with just the ticket that you created.
Now finally let's try to update this ticket that we just made a moment ago.
It's going to take its idea.
Once again I'm going to change the request type to a put I'll make the request to API tickets and then
the I.D. then we could add in a new title and a new price.
So for example I could put in a new title Love How about new concerts and a price of five hundred I'll
make that request and there we go.
I get a response back with the updated data and of course if you really want to test this we could try
to fetch that ticket again so I can change this back to a get leave the euro all the same.
That's the ticket and I'll see details about the one that I just updated.
Yep looks like all that data was persisted successfully.
OK.
So overall I'd say this looks pretty good.
I think that our ticket service is working.
So let's take a quick pause right here and continue in just a moment.