asp.net - 在 postman 中发送实体模型

标签 asp.net asp.net-web-api postman

我创建了一个 Web API 并想用 postman 检查它,但不知道如何发布我的实体模型。总是模型为空

我使用 [FromForm] 给我发送模型,但所有值都为空,当使用 [Frombody]
发送空值

最佳答案

. your error is the CONTENT TYPE you're using to send the request ..你选择x-www-form-url-encoded (HTML 表单的格式).. BUT if you want to use WebAPI and send your Entity in the PAYLOAD of yours request via REST .. you have to set CONTENT - TYPE as application/JSON ..

所以in POSTMAN do:
1- 选择类型 RAW
2- 在出现的下拉菜单中选择 application/json
3- paste your JSON in the Text Area
4- send it
希望对你有帮助!!

关于asp.net - 在 postman 中发送实体模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47754392/

相关文章:

c# - ASP.Net MVC C# AutoMapper 使用 Where 语句

c# - 使用 Web Api Http Put 时出现内部服务器错误 500

c# - 来自数据库的数据未返回,但正常列表是

c# - 如何使用适合导入的 Web Api 帮助页面从 Web Api 2 项目生成 JSON Postman 集合

node.js - 当我在 Postman 中使用表单数据时,结果未定义

asp.net - 将图标添加到 Label 控件中的文本字段

c# - 如何在 Repeater 中应用样式

javascript - 如何使用 javascript 回发到不同的表单

javascript - 如何将空数据类型和数字数据类型集成到我的架构中?

javascript - 如何在 Postman 中获取测试状态(即通过、失败或错误)?