次のように、CURL を使用して単純な POST パラメーター (int) を ASP.NET Web API コントローラーの POST メソッドに送信しようとしています。
curl -d "id=1" --ntlm --user <user>:<pass> http://dev.test.local/api/test
これは Curl の POST にデータを添付する正しい方法ですか? URL に問題なく接続できますが、サーバーから次のエラーが返されるため、パラメーター 'id' が渡されないようです。
"The parameters dictionary contains a null entry for parameter 'id' of non-nulla
ble type 'System.Int32' for method 'System.String Post(Int32)' in 'Test.Si
te.Controllers.TestController'. An optional parameter must be a reference type,
a nullable type, or be declared as an optional parameter."
OrderController の POST メソッドは次のとおりです。
// POST api/test
public string Post(int id)
{
return "Post successful";
}
どんな助けでも大歓迎です。