asp.net-web-api - 如何通过邮递员将自定义对象数组作为多格式数据内容发送到asp.net web api?
问题描述
如何通过 Postman 将自定义对象数组正确发送到 asp.net web api?我所做的是:
自定义类:
public class SystemConsumerConfiguration
{
public int SystemId { get; }
public Uri CallbackUrl { get; }
public SystemConsumerConfiguration()
{
}
public SystemConsumerConfiguration(int systemId, Uri callbackUrl)
{
SystemId = systemId;
CallbackUrl = callbackUrl;
}
}
在 REST API 中查看模型:
public class PostDigitalPostSubscriptionConfiguration
{
public IReadOnlyList<SystemConsumerConfiguration> SystemsModel { get; set; }
public IFormFile Certificate { get; set; }
public PostDigitalPostSubscriptionConfiguration()
{
}
}
现在,我在 Postman 中提出请求
解决方案
忘记在SystemConsumerConfiguration
.
应该是这样的:
public class SystemConsumerConfiguration
{
public int SystemId { get; set; }
public Uri CallbackUrl { get; set; }
public SystemConsumerConfiguration()
{
}
public SystemConsumerConfiguration(int systemId, Uri callbackUrl)
{
SystemId = systemId;
CallbackUrl = callbackUrl;
}
}
推荐阅读
- mysql - 数据框的类型为“无类型”。我应该如何改变它以允许合并功能运行?
- python - 批量读取 mysql 最终会命中所有行
- excel - 需要删除或隐藏显示空白的行。但是里面有公式
- jquery - 如何获取 Ajax 内容以引导 4 工具提示?
- r - 如何将每个单元格包含多个分隔记录的数据“解压”为长格式
- flutter - Flutter 应用程序的大小比 Play Console 所说的要大得多
- html - 如何阻止 HTML 表格匹配网格中其他人的高度?
- python - 如何在不出现 UnicodeEncodeError 的情况下将 pandas 数据帧转换为 csv 文件
- arrays - 多个列表中的多个关键字替换
- excel - 如何找到行中的最后一个数字减去行中倒数第二个数字