Hi I'm trying to build my first API wit ASP.net Core and have been following this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio
I'd like to find out why I'm unable to post anything to my database (which I have setup in previous steps)
I'm using songs instead of todo's and when I try to make a POST request in postman I get this response
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
"title": "Unsupported Media Type",
"status": 415,
"traceId": "|25aa76f-4966fce03006b505."
}
It doesn't matter what key:value pairs I send to my API, when using the post method I will always get the same response.
my Song class looks like this:
public class Song
{
public int Id { get; set; }
public string Title { get; set; }
public string Artist { get; set; }
[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }
public string Spotify { get; set; }
public string Youtube { get; set; }
public string Instagram { get; set; }
}
This is the link to the exact step I'm at: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio#test-posttodoitem-with-postman
ps. I'm still very new when it comes to programming and it will probaly been something super obvious.