Need to invoke the following url from PowerShell script:
$webAPIUrl = "http://hostName:portNumber/test/schedule-process/22/true"
While invoking exception thrown as "An error has occurred."
PowerShell script:
Invoke-WebRequest -Uri $webAPIUrl -Method get -UseBasicParsing
Same exception was thrown while checking this url with Postman.
C# API code:
public class ScheduleController : ApiController
{
[HttpGet]
public void SchedulingProcess(int scheduleId, bool isScheduleStart)
{
}
}
Route configuration code:
config.Routes.MapHttpRoute("SchedulingProcess","test/schedule-process/{scheduleId}/{isScheduleStart}",new { controller = "Schedule", action = "SchedulingProcess" });
Working fine while calling from C#:
string webAPIUrl = "http://hostName:portNumber/test/schedule-process/22/true";
new WebClient().OpenReadAsync(new Uri(webAPIUrl));
Please help me to invoke this url from PowerShell script.