我使用curl向Web服务http://localhost:2325/Service发送POST请求。
如何将POST请求的正文反序列化为一个变量,以便我可以在我的POST方法内访问它?
有人能给个例子吗?
这是我的方法:
[WebInvoke(RequestFormat = WebMessageFormat.Json, UriTemplate = "/user", Method = "POST")] public void Create(User us)
用户类包含user_id
和user_name
。
请问有人可以帮忙吗?我需要一个如何在curl中制定POST请求的示例。
我已经尝试过这个,但它不起作用:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"user":{"user_name":"Name1","user:id":"11"}}' http://localhost:3000/api/1/users
curl
有什么关系。你能进一步展开吗? - Cameron