Reputation: 43
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.
Upvotes: 2
Views: 3320
Reputation: 6951
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";
Upvotes: 2