How to pass json value to API using post in C #?
I am new to C #, you can tell me the best way to pass json API value in C # using POST.
Below I have written pyhton code but dont know how to do it in C #.
string payload = {
"username" : "1432143352759a61bca0ad4a35a4f0", # when you register, they'll return this
"password" : "password",
"client_id" : "c3ca1565b0dbedd74c5c",
"client_secret" : "e0591fe41c4e2585b313ad93e2748022db3186d0",
}
res = requests.post("https://sandbox.synapsepay.com/api/v2/user/login", payload)
print res.status_code
print res.text
+3
source to share
1 answer
From a .NET client (like WinForm) you can use the HttpClient.
Check out this solution:
http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client
+1
source to share