Home > Blockchain >  how to add Path Parameter on http client c#
how to add Path Parameter on http client c#

Time:02-04

how to add Path Parameter on http client c# url example https://testurl/accounts/product/:productid/user/:userid?fields=Attributes

I tried adding with KeyValuePair but no luck.

enter image description here

CodePudding user response:

You can use string interpolation and concatenation. I think this is what you are askin for;

        int userId = 1;
        string url = $"https://testurl/accounts/product/:productid/user/{userId}";
       // Add here if there is any condtion if() or any loop
        url  = "?fields=Attributes";
  •  Tags:  
  • Related