You must call the following URL from a PowerShell script:
$webAPIUrl = "http://hostName:portNumber/test/schedule-process/22/true"
When an exception is thrown as "An error has occurred."
PowerShell script:
Invoke-WebRequest -Uri $webAPIUrl -Method get -UseBasicParsing
The same exception was thrown when checking this Postman URL.
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" });
Works fine when called from C #:
string webAPIUrl = "http://hostName:portNumber/test/schedule-process/22/true";
new WebClient().OpenReadAsync(new Uri(webAPIUrl));
Please help me call this URL from a PowerShell script.
source
share