WCF REST Service - Using QueryString Parameters

I have this WCF REST service.

[WebInvoke(UriTemplate = "/GetNames/{Category}?order=asc", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] public List<Names> GetNames(string Category) { //Code to retrieve Names by category. } 

The Category parameter is displayed in {Category} in Uri.

But how can I match the order string in Uri with this method?

Adding order as a parameter method does not work.

please, help. thanks in advance.

+1
source share
1 answer

Have you tried - "/ GetNames / {Category}? Order = {ordering}" in the Uritemplate and in the function

 public List<Names> GetNames(string Category, string ordering) { //Code to retrieve Names by category. } 
+2
source

Source: https://habr.com/ru/post/921697/


All Articles