Posting Form Data to an OData Web API RRS feed

  • Question

  • User-1014810985 posted

    As OData itself work as a formatter over existing Web API. How could we send a form data (Content Type- multipart/form-data) request to OData API. Is it possible or we need to use media link entries (OData feature).

    Some how i am getting unsupported Media Type Exception while sending a form data request to OData API.

    Thursday, May 23, 2019 5:21 AM

All replies

  • User-1764593085 posted

    Hi abhilashM,

    The web api has an access to form data using `[FromForm]` attribute instead of `[FromBody]`

    public IActionResult Post([FromForm] YourModel model)

    Best Regards,


    Thursday, May 23, 2019 7:09 AM
  • User-1014810985 posted

    I have tried [FromForm] it works absolutely fine if it is a basic Core Web API 2, but when the request is sent to OData service I get the below exception.

    {Microsoft.OData.ODataContentTypeException: A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false, application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true, application/json;odata.metadata=minimal;odata.streaming=true, application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false, application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true, application/json;odata.metadata=minimal;odata.streaming=false, application/json;odata.metadata=minimal;IEEE754Compatible=false, application/json;odata.metadata=minimal;IEEE754Compatible=true, application/json;odata.metadata=minimal, application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false, application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true, application/json;odata.metadata=full;odata.streaming=true, application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false, application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatib...' matches the content type 'multipart/form-data; boundary=--------------------------607563766636693325360589'.

    Thursday, May 23, 2019 9:53 AM
  • User-1764593085 posted

    Hi abhilashM,

    It works well when I follow this tutorial and try to call it with Postman. You'd better share necessary code on how you configure the oData web api and how do you call the oData service (postman,ajax...) to reproduce the problem.

    Friday, May 24, 2019 2:46 AM