I need to create the following PHP POST in C#
$params = array(
'method' => 'method1',
'params' => array
(
'P1' => FOO,
'P2' => $Bar,
'P3' => $Foo,
)
);
I cannot figure out how to create the params
array. I have tried with WebClient.UploadString()
with a json string to no avail.
How do I construct the above in C# ?
I try
using (WebClient client = new WebClient())
{
return client.UploadString(EndPoint, "?method=payment");
}
The above works but needs further parameters.
using (WebClient client = new WebClient())
{
return client.UploadString(EndPoint, "?method=foo&P1=bar");
}
P1
is not recognised.
I've tried with UploadValues()
but cannot store the params in a NamedValueCollection
The API is https://secure-test.be2bill.com/front/service/rest/process