0
如何在RestSharp中發佈數據?我對RestSharp非常陌生,不太瞭解這個過程。如何在RestSharp中發佈數據?
我很熟悉Get Requests,我寫了API測試沒有問題。
使用下面的示例我要發佈的訂貨量:
"name": "PostToCurrentBasket",
"class": [
"PostToCurrentBasket"
],
"method": "POST",
"href": "*",
"title": "Add Product to Current Basket",
"type": "application/json",
"fields": [
{
"name": "ProductId",
"type": "text",
"value": 101112,
"title": "Product ID"
},
{
"name": "Quantity",
"type": "number",
"value": 0,
"title": "Order Qty"
}
]
}
],
我迄今爲止:我需要
var request = new RestRequest("baskets/current/", Method.POST);
做的是使用.AddBody如果是的話我該怎麼辦正確使用它?
我得到一個狀態碼400,表示必須傳遞正確的數據。有沒有辦法找出API所期望的數據? – user3451887 2014-11-21 10:02:48
好的,這是一個HTTP錯誤的請求錯誤。沒有技術方法可以找出REST-api的預期輸入。您將不得不搜索我害怕的文檔。 – 2014-11-21 12:40:44