Pass decimal as value in WebAPI 2 URL

Got it working by adding a "/" to the end of the URL!

http://localhost:4627/api/Product/Eligibility/10.5/

Will find this method:

// GET api/Product/Eligibility/10.5/
[Route("api/Product/Eligibility/{amount:decimal}/")]
public decimal GetEligibiilty(decimal amount)
{
    return amount;
}

Steve


I recently had this problem while working with Web API in Visual Studio 2015. I solved the problem by adding ?parameterName=decimalValue at the end of the URL. In your case could be something similar to this:

http://localhost:4627/api/Product/Eligibility?amount=10.5

I hope can help.