I am trying to test my REST API through postman and I am getting the following error:
This is my first REST API that I have written and I am very new to postman so not sure what am I doing wrong. Below is my code that I am trying to call in postman with this URL. I am passing two date parameters in the URL
https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020
Below is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RecLoad.DAL;
namespace RecLoad.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class RecLoadPrimeController : ControllerBase
{
[Route("RecLoadPrime/insertRecLoadData/{RecStartDate}/{RecEndDate}")]
[HttpPost]
public void insertRecLoadData(string RecStartDate, string RecEndDate)
{
RecLoadDataProvider dataProvider = new RecLoadDataProvider();
dataProvider.InsertData(RecStartDate, RecEndDate);
}
}
}
There is nothing under the other tabs, Authorization, Headers, Body, PreRequest scripts, Test and settings of postman. Below is the screen shot from postman:
when I trying to run the API directly by putting this URL in the browser, I am getting the error saying:
This localhost page can’t be foundNo webpage was found for the web address: https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020
The ECONREFUSED error means that the request to establish a connection with another service was refused and that something blocks the request. There can be many reasons why your request is blocked.
econnrefused means most probably you have not started your server on port 8080. ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
Add the request URL ( localhost:4000/users ) in the appropriate textbox. In order to create a new resource in this database, we need to supply a user object to create in the body of the POST request. Select the “Body” tab and check the “raw” radio button to specify input. Press the Send button to send the POST request.
I was getting the same error. This solved my issue:
File -> Settings -> Proxy, then unmark "Use the system proxy"
Notice that I'm using Postman only for development (localhost), so I disabled the proxy.
I was also getting the same error. This solved my issue :
I have unchecked the Use the System roxy as Sverissimo. But still i was getting the same error. So i Disabled the SSL Certificate Verification Which is in File => Settings => General Tab(Under Request section SSL Certificate verification)
as i was just Learning API through by creating a sample project(API).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With