title: Keeping same rest endpoint for complex types in asp.net core api
body: <p>I have a Rest endpoint, lets call it tags</p>
  
  <p><a href="http://api/tags" rel="nofollow noreferrer">http://api/tags</a></p>
  
  <p>which creates tags objects passing this json format:</p>
  
  <pre><code>[{
     "TagName" : "IntegerTag",
     "DataType" : 1,
     "IsRequired" : true
  }]
  </code></pre>
  
  <p>If I would like to maintain the same endpoint to create new tags but with  different json format. Lets say I want to create a ListTag</p>
  
  <pre><code>[{
     "TagName" : "ListTag",
     "DataType" : 5,
     "Values" : ["Value1", "Value2", "Value3"]
     "IsRequired" : true
  }]]
  </code></pre>
  
  <p>or a RangeTag</p>
  
  <pre><code>[{
     "TagName" : "RangeTag",
     "DataType" : 6,
     "Min": 1,
     "Max": 10,
     "IsRequired" : true
  }]
  </code></pre>
  
  <p>I am not having any problem with C# to create a new Dto on my controller api and pass it as a different parameter because C# admits methods overloads for that:</p>
  
  <pre><code>void CreateTags(TagForCreateDto1 dto){…}
  
  void CreateTags(TagForCreateDto2 dto){…}
  </code></pre>
  
  <p>But when I need to maintain in the same controller both methods with a POST request to create the tags, mvc does not allow for the same route to have both.</p>
  
  <pre><code>[HttpPost]
  void CreateTags(TagForCreateDto1 dto){…}
  [HttpPost]
  void CreateTags(TagForCreateDto2 dto){…}
  </code></pre>
  
  <blockquote>
    <p>An unhandled exception occurred while processing the request.
    AmbiguousActionException: Multiple actions matched. The following
    actions matched route data and had all constraints satisfied.</p>
  </blockquote>
  
  <p>Please advise</p>