. Advertisement .
..3..
. Advertisement .
..4..
I’ve looked at a lot of links to try to figure out what caused the mistake, but none of them have helped me.
I’m attempting to use Postman to access a WebAPI operation but am encountering the following problem: no http resource was found that matches the request uri.
This is my API.
[Authorize]
public class AlbumsController : ApiController
{
[HttpGet]
[Route("api/album/history/")]
public BaseTO GetHistory(string type,int id)
{
//api stuff
}
}
While on the contact with the postman, I am passing:
-Authorization Token
-Type
-Id
Please help me fix it. Thank you so much.
Solution:
Here are a few solutions that I hope can help to fix the error no http resource was found that matches the request uri.
Solution 1.
Have you made sure that the
config.MapHttpAttributeRoutes();
for the api is enabled for attribute routing?The following query string should be used to access it using your current route:
http://localhost:50684/api/albums/history?type=test&id=1
Then add the [FromUri] decoration to the parameters
or to use route parameters to access the api
http://localhost:50684/api/albums/history/test/1
Solution 2:
The code should be like this:
Ensure that your Postman method is GET:
http://localhost:50684/api/album/history?type=test&id=1
Solution 3.
Just adjust this:
AllowInsecureHttp = true