c# - how to pass parameters to asp.net web api get method? -


following method in asp.net web api.

[httpget] public ihttpactionresult getdetails([frombody] retrievedetails  edetails) {} 

following class

public class retrievedetails {      public string name{ get; set; }          public string type { get; set; }  }      

when try call getdetails fiddler edetails null.

http://localhost:101222/api/emailservice/getdetails?name=testname&type=testtype

i tried different methods value null. if change [httpget] [httppost] , add request body working fine. need method.

do need [frombody] there if passing values in url get. should using [fromuri] if passing values in querystring.

https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -