1
這是我寫的C#代碼請求數據Restsharp請求參數語法問題
{
"delivery_needed": "false",
"merchant_id": "201",
"merchant_order_id": "123456",
"amount_cents": "25000",
"currency": "USD",
"items": [],
"shipping_data": {
"name": "test_user",
"street": "sample street",
"city": "cairo",
}
}
的例子,但似乎還有與航運數據,以及項目的語法錯誤。
這是我
錯誤{\ 「shipping_data \」:{\ 「non_field_errors \」:[\ 「資料無效預期一個 字典,卻得到了STR \」]}, \「項目\」:\「預期的項目列表,但 了輸入\\」海峽\\「 \」]}
這是C#代碼我寫的,我很困惑的語法
var client = new RestClient("url");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", request.AddJsonBody(new { delivery_needed = "false", merchant_id = "201", merchant_order_id = "123456", amount_cents = "25000", currency = "USD", items = "[]", shipping_data = "{ ", name = "test_user", street = "sample street", city = "Cairo"}), ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
的例子,非常感謝您的澄清 –