This is part 4 of Web API Tutorial series. In this tutorial, you will learn testing Web API using Postman. In this tutorial, we will test Bearer authentication using Postman.
In last chapters, you learnt creating MVC + Web API application and implemented Bearer authentication using custom authentication filter. In this chapter, you will learning testing Web API using Postman. Before we start, let me tell you something about Postman. There are n numbers of tools available for testing RESTful services but Postman is globally accepted tool for testing because of its features and user-friendly UI. In this tutorial, we have use Postman to test Bearer authentication. Please follow below steps or watch this video, it has same steps what is explained in below sections.
Before we start, let's take an overview of Postman tool. In Postman, there are many options which we can apply why testing our API. You can create a new request to test your service, create new collection for set of request, you can also create an environment to run your service. Postman gives you many features which enable to test your API service very efficiently and very effectively without overheaded configurations. You can choose any verb from pre-defined set of options according to your requirement.
Below you can see the list of HTTP verbs available in Postman.
Now let's create a GET request and add Bearer token in Authorization parameter. For that, follow below steps.
Now in Header tab, click on Temporary Headers. Here notice that token has been added as value for Authorization key.
Click Send button.
Now notice that more key-value added in header section. It contains request information like host, user-agent, cache, authorization and so on.
Now,click on Body tab. Here you can see the sevice response in JSON format.