3

I am new to c#,can you tell me what is best way to pass json value to API in c# using POST.

Below I have written python code, but not sure 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
Ismael Padilla
  • 5,246
  • 4
  • 23
  • 35
nikunjM
  • 560
  • 1
  • 7
  • 21

1 Answers1

1

From a .NET client (e.g WinForm), you can use HttpClient.

Check out this solution:
http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client

Carl Prothman
  • 1,461
  • 13
  • 23