I can not send email to my WebApi

0

I'm trying to create a function in my WebApi where I return information based on the email address that I send, the problem is that the ". break the route.

In case I did my action like this:

[AcceptVerbs("GET")]
[Route("Usuarios/GetUsuarioPorEmail/{email}")]
public IQueryable<Usuarios> GetUsuarioPorEmail(string email)

I tried calling all these ways and none worked, link link link link link

But if I call it like that, it works
link

There is no pointless email.

    
asked by anonymous 29.11.2017 / 22:39

2 answers

0

To avoid this scenario, include a forward slash at the end of the route. This implementation will delimit the email parameter between the two slashes and will not consider it as part of the domain.

[Route("Usuarios/GetUsuarioPorEmail/{email}/")]
public IQueryable<Usuarios> GetUsuarioPorEmail(string email)
    
30.11.2017 / 00:37
0

Do this:

[AcceptVerbs("GET")]
[Route("api/Usuarios/GetUsuarioPorEmail")]
public IQueryable<Usuarios> GetUsuarioPorEmail(string email)
{
}

and call in for testing like this:

http://localhost:80/api/Usuarios/[email protected]

result if you were to print the email:

That is, a get parameter, of course, after this receipt, an email validation is required not to have problems with invalid data.

    
30.11.2017 / 00:38