I have a POST Web API method that excludes a custom complex MyObjectRequest object as a parameter and returns a custom complex MyObjectResponse object. The MyObjectResponse object has a custom complex Token object as a property.
public class MyObjectRequest { public string AppName { get; set; } public string Username { get; set; } public string Password { get; set; } public string AppIdentifier { get; set; } } public class MyObjectResponse { public bool Authenticated { get; set; } public Token AccessToken { get; set; } } public class Token { public string Id { get; set; } public string ExpirationDate { get; set; } }
I have an API API where, when a user makes an HTTP POST request, I want to return MyObjectResponse .
public class MyCustomController : Controller { public MyObjectResponse Post([FromBody] MyObjectRequest request) {
Is this the right way to create my signature MyCustomController API?
rest asp.net-mvc asp.net-web-api
Michael kniskern
source share