2

This method is idempotent according to the http spec which means it should be of type GET

[Route("GetLoadProfile")]
[ResponseType(typeof(List<ufnGetCustomLoadProfile_Result>))]
public async Task<List<ufnGetCustomLoadProfile_Result>> LoadProfile(int accountId, DateTime startTime, DateTime endTime)
{
    List<ufnGetCustomLoadProfile_Result> result = await db.ufnGetCustomLoadProfile(accountId, startTime, endTime).ToListAsync();

    if (result == null)
        return null;

    return result;
}

I do not specify that it should be POST and yet ASP.NET WEB.API 2 generates a POST method.

enter image description here

Why does this happen?

Freek Nortier
  • 780
  • 1
  • 13
  • 27
  • 2
    Why don't you just set it as `[HttpGet]`? – Stan Aug 04 '16 at 14:07
  • @Stan I could do that. Just interested why this method is generated as a POST when it should be a GET. – Freek Nortier Aug 04 '16 at 14:10
  • 1
    good question. already answered here though. http://stackoverflow.com/a/23687383/17447 its because `POST` is the default method – naveen Aug 04 '16 at 14:18
  • 2
    Your action name should start with "Get" or "Put" or "Post" etc to have the "Verb" selected on that criteria. Otherwise the default verb for WebAPI is "POST". – Venkata Dorisala Aug 04 '16 at 14:18

0 Answers0