This year has been a lot about migration. Since Umbraco 7 will be end of life quite soon we help a lot of clients to migrate.
There is a lot of great content already out there about the migration process so I figured I'll share some of the "bumps"
JQuery and Umbraco Api Controllers
Many times we have code that sends a vanilla MVC-form using JQuery's $.post feature like this:
$.post("/Umbraco/Api/MyController/DoSomething", $("#form").serialize())
When posting this to the controllers we noticed a strange error from the controller.
{
"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13",
"title":"Unsupported Media Type",
"status":415,
}
JQuery will post the data as form data but the controller expects JSON, the simple solution is to add a [FromForm]-attribute in the controller action.
[HttpPost]
public IActionResult DoSomething([FromForm] MyModel model)
{
}