【发布时间】:2019-03-31 19:55:23
【问题描述】:
我正在尝试在 Postman 中调用以下 Web API 方法:
public HttpResponseMessage GetAllNotifications(HttpRequestMessage request, String Name)
{
HttpResponseMessage response = null;
try
{
List<ExpandoObject> res = _userProcess.GetAllNotifications(Name);
response = request.CreateResponse<List<ExpandoObject>>(HttpStatusCode.OK, res);
}
catch (Exception ex)
{
response = request.CreateResponse<string>(HttpStatusCode.BadRequest, "Unable to process your request Please contact administration");
throw new DataException(ex.Message.ToString());
}
return response;
}
任何建议表示赞赏。
【问题讨论】:
-
到目前为止你尝试过什么?而且您可能希望格式化您的代码,使其可读...
-
格式化代码。
-
这里详细说明如何认证用户,然后通过post mastackoverflow.com/questions/42976982/…与api通信
-
如何在 Postman GET 和 POST 请求中调用用户控制器中的 GetAllNotifications 方法
标签: asp.net-web-api