Produces : It is a filter attribute that specifies the expected System.Type the action will return and the supported response content types.
Consume: It is a filter attribute that specifies the supported request content types.
namespace Microsoft.AspNetCore.Mvc
ProducesAttribute
[HttpGet]
[Produces("text/xml")]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2", "Value3" };
}
Consume: It is a filter attribute that specifies the supported request content types.
namespace Microsoft.AspNetCore.Mvc
ConsumesAttribute
[HttpGet]
[Consumes("application/json")]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2", "Value3" };
}
