ASP.NET Tutorial: How to Importing .NET Core APIs into Postman?

We can import API data into Postman API Collection with ease by using Swagger.

Copy the URL: https://localhost:7123/swagger/v1/swagger.json

Open the Postman application. If you don’t have an account, please create one and download the application.

Press the “Import” button. A popup similar to the one below will open.

Paste the copied URL in the highlighted textbox.

Click the Import Button once again in the box, It will create the collection as follows.

API Collection Highlights

We will set Authorization globally here in this tab.

In the Variables tab.

We can override the values below the image for our deployment environment settings.

  • If Development baseUrl: https://localhost:7123
  • If Testing baseUrl: https://test-api.domain.com

More details as below as an image.


While hitting the Send button (in Blue color), our endpoint will be triggered and get the API response.

The proper username and password will provide the results below.

Practical API Testing Techniques for Accelerating Development

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Body isSuccess as true", function () {
    pm.expect(pm.response.text()).to.include("\"IsSuccess\":true");
});

pm.test("Body message", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.Message).to.include("Login Success");
});

pm.test("Body Email Found", function () {
    var jsonData = pm.response.json();
    console.log("Value of Email in the Response Body - " + jsonData.Data.Email);

    pm.expect(jsonData.Data.Email).to.not.eql(null);
    pm.expect(jsonData.Data.Email).to.not.eql("");
    pm.expect(jsonData.Data.Email).to.be.an('string');
});

Basic scripts help developers unit-test their endpoints following the TDD approach.

In the example below, we see that the response was 200, but the email data in the response was missing, causing one test to fail.

The response below was passed with a score of 4/4.

Best and Most Recommended ASP.NET Core 8.0.7 Hosting

Fortunately, there are a number of dependable and recommended web hosts available that can help you gain control of your website’s performance and improve your ASP.NET Core 9.0 web ranking. HostForLIFEASP.NET is highly recommended. In Europe, HostForLIFEASP.NET is the most popular option for first-time web hosts searching for an affordable plan.

Their standard price begins at only €3.49 per month. Customers are permitted to choose quarterly and annual plans based on their preferences. HostForLIFEASP.NET guarantees “No Hidden Fees” and an industry-leading ’30 Days Cash Back’ policy. Customers who terminate their service within the first thirty days are eligible for a full refund.

By providing reseller hosting accounts, HostForLIFEASP.NET also gives its consumers the chance to generate income. You can purchase their reseller hosting account, host an unlimited number of websites on it, and even sell some of your hosting space to others. This is one of the most effective methods for making money online. They will take care of all your customers’ hosting needs, so you do not need to fret about hosting-related matters.