zeeshan
zeeshan

Reputation: 79

Web API end point not working from postman but from swagger

I am working on WebAPI .Net Core 2.2, I have successfully added swagger and from swagger UI I am able to create POST or GET request. But when I execute endpoint from Postman nothing happened. Even break point hit on endpoint but proper result is not shown on postman UI

[HttpPost]
[Route("Details/{year:int}/Directors")]
public ActionResult DirectoryMoviesByYear(int year) 
{
     //sample code 
     return Ok(new Director { Id=1, Name="Peter Jackson" });

}

end point used in Postman https://localhost:44386/api/Movie/Details/1980/Directors

here is swagger screen shot result from swagger here is postman screen shot enter image description here

Upvotes: 5

Views: 16835

Answers (3)

anon37894203
anon37894203

Reputation: 545

In case someone stumbles upon this in the future, make sure that if you have an [Authorize] tag in your method, you call your login endpoint first. Apparently there is no need to do this in Swagger but you need to do it in Postman.

Upvotes: 0

Alexander
Alexander

Reputation: 9642

Looks like you are using self-signed certificate for https and Postman just blocks request because of it. Configure Postman to not verify SSL cetrificates in File -> Settings

enter image description here

Upvotes: 23

shafaetjsr
shafaetjsr

Reputation: 318

Make Sure You OFF SSL certificate validation From Postman -> Preferences -> General -> SSL certificate validation -> OFF

and it's Working for me

Upvotes: 3

Related Questions