我需要在C#创建以下PHP POSTC#中使用REST API之后的参数作为数组
$params = array(
'method' => 'method1',
'params' => array
(
'P1' => FOO,
'P2' => $Bar,
'P3' => $Foo,
)
);
我无法弄清楚如何创建params
阵列。我用WebClient.UploadString()
与json字符串尝试无济于事。
如何在C#中构建上述代码?
我尝试
using (WebClient client = new WebClient())
{
return client.UploadString(EndPoint, "?method=payment");
}
上述作品,但还需要进一步的参数。
using (WebClient client = new WebClient())
{
return client.UploadString(EndPoint, "?method=foo&P1=bar");
}
P1
无法识别。
我试着UploadValues()
但不能PARAMS存储在NamedValueCollection
的API是https://secure-test.be2bill.com/front/service/rest/process
你在打什么API?如果可能,阅读文档将会很酷。 –
https://secure-test.be2bill.com/front/service/rest/process –
什么是downvotes? –