What we're going Todo now is that we're going to clone the application that we're going to use, that we're going to be writing tests against in this course. And we're basically going to be running that application locally. So this application is just really simple Todo application is quite simple and straightforward and it's quite easy to get it installed and running. It's just a good application for playing around with and writing some API tests against. It's got a UI as well so that we can actually see the impact of the application. So let's go ahead and get it set up and start running it.
Just head over to this website. So we're at Karate Labs, GitHub, we're on the Karate Todo app. I'm just going to clone this to my machine, so I just click code on here and then I'm just going to copy this HTTPS command here. I'm going to open up a terminal. And what I'm going Todo is I'm just going to say, Git clone and then I'll just paste in the Git command that we just copied. Enter, and that's just going to clone that into this repo for us. It's going to change the directory now into that repo. So now in the Karate Todo repo in order to run the application, I just need to type mvn clean test and then minus the test equals local runner. I'm just going to hit enter here. What will happen now is that Maven is going to go ahead and pull in all of the dependencies that we need for this project and it should go ahead and start the application. So we can see at the bottom here we're getting a message saying that the server has been started. So we now head back over to our browser. I just head to this address localhost 8080, you should see here now that the application is running. Again, this is just a really simple Todo application with the UI. Let's have a look around the UI. So it just says what needs to be done. Let's just say task one, we hit enter and then that creates a task for us. Set some more tasks like Go shopping, Learn to code, Eat dinner, etc. This UI's got a bit of functionality. So if we toggle this here, we can see that it ticks all of the Todos. Looks like if you tick them and that means that they're completed because to tick individual ones I think we can also filter on them as well. Now, I've got those two ticked. If I take on completed, it just shows the completed ones. I click on Active, it just shows the active ones. This x here, I'm guessing, clears the Todo. Looks like it does. We got a message here saying of the number of Todo that are left. We can also clear the completed Todo as well. So this is how to use the application for that UI. But what about through the API calls? For this course, we're going to be more interested in making direct API calls rather than going for an actual UI. So let's have a look at the API calls now as well. So again, for the API calls, I'm going to be using a tool called Postman which is going to allow me to just send API calls directly to the application.
I'm here in Postman. I've added in basically all of the distant API calls that the Karate Todo application explorer. I'm just going to go through them one at a time. So the first one here, this one just completes the Get call and it just lists all of the Todo that the application currently has. So it doesn't take any authorization or headers or body or anything like that because it's just to Get call that can make just make this Get call here. And then it would just return any of the Todos that I have. So don't actually have any Todos created yet. Let me just go ahead and add one. And Todo that, I can just make this Post call here. This Post call is similar. It calls the Todo some point, but this time it's a Post call. And what I'm doing is I'm just sending this really simple problem JSON here with a title of my Todo and the status of it as well in this case complete. Let just hit send on that. And then I get this response back here at the bottom, just to show that the Todo has been created. We can also see as well that we get a status of 200 back.
Let me just make a couple more about just change the name to Task 2 for example, and I'll also make one for Task 3 as well. And I'll choose that one status to complete. Now if I call the Get all Todos, now I'm getting back these JSON objects or this JSON array and that's got three different objects in. So one that firstTask, second task, and the third task. As well as getting all Todos, I can actually just get a single Todo as well. For this one, what I do is I need to call this endpoint here. Then I need to put in this ID at the end just to get which I'm in particular Todo that I'm interested Todo. To go to my Get all Todo response. If I wanted to describe, I say this Todo, I just need to take this ID here. I'll copy that to my clipboard and then on the Get single Todo call, what I do is I'll replace this ID at the end here like so. And if I make that call and the API just returns this single task for us, then we get a 200 response. So if I was putting an ID that doesn't exist, try to call that. And this time we get an error back. We get a 404 not found, which is what we would expect. It's quite up when it ends. Make sure it's okay. Next thing that we could do is that we could update the status of the Todo as well.
Again, to do that, we would need to put in the ID of the Todo. Let's take this second task here, what I'll do is I'll just grab this second task ID. Grab the ID. Go over to the update call and the update call is Put. You can see here that we changed the word to be a Put. You can put that ID in here. What I want to do is I want to change the task status to this one to be complete what changed that could be I should say to true. We'll send it over. We get the response to 200 OK back. And I go over to get all Todos. I call it again. Let's see now the task number two, this one is changed to be true this time. Final thing that we could do is that we can delete Todo. This probably works in the same way that you expect.
Again, we specify the delete by pair and we just need to put in the ID of the Todo that we want to delete. Again, I'll just grab this one here, copy that, go over to the delete call. Paste and watch. Then can we get a 200 response back just to confirm that the Todo has been deleted? We're trying to send again and delete it again. This time we get a 404 not found. Again, if I look at all the Todo we can see now we've only got these two Todos left.