I have .NET Core Web API project. One of my action controller is:
[HttpPost]
public async Task<IActionResult> Notify([FromForm] NotifyInput input)
{ ... }
NotifyInput.cs file is in separate project (.NET Standard):
public string BodyPlain { get; set; }
public string BodyHtml { get; set; }
public List<Attachment> Attachments { get; set; }
public class Attachment
{
public int Size { get; set; }
public string Url { get; set; }
public string Name { get; set; }
public string ContentType { get; set; }
}
And params I send to this method are:
body-plain: 123
body-html: <p>123</p>
attachments: [{"url": "http://example.com", "content-type": "image/jpeg", "name": "pexels-photo.jpg", "size": 62169}]
I'm trying to send my data via Postman as x-www-form-urlencoded and as form-data.
But when I debug this code, I see they are all NULL.
Attribute [JsonProperty("body-plain")] didn't help me.
How can I bind these params?
attachmentswon't work at all. If you're goingx-www-form-urlencoded, you've got to go all the way, which means having separate params for each property of each attachment, i.e.attachments[0].Url,attachments[0].ContentType, etc.attachments[0].urlworks fine, but what aboutbody-htmlorattachments[0].content-type?