title: 415 (Unsupported Media Type) with REST Post request
body: <p>I have a react component that when a checkbox is pressed, it calls a rest api, post request with a single parameter.</p>
  
  <p>I put a breakpoint in the webapi and its never hit, still I get a 415 unsopported media type on the component</p>
  
  <pre><code>react js component (see onchange event)
  
  import React, { Component } from 'react';
  import {  Table, Radio} from 'antd';
  import { adalApiFetch } from '../../adalConfig';
  import Notification from '../../components/notification';
  
  class ListTenants extends Component {
  
      constructor(props) {
          super(props);
          this.state = {
              data: []
          };
      }
  
  
  
      fetchData = () =&gt; {
          adalApiFetch(fetch, "/Tenant", {})
            .then(response =&gt; response.json())
            .then(responseJson =&gt; {
              if (!this.isCancelled) {
                  const results= responseJson.map(row =&gt; ({
                      key: row.ClientId,
                      ClientId: row.ClientId,
                      ClientSecret: row.ClientSecret,
                      Id: row.Id,
                      SiteCollectionTestUrl: row.SiteCollectionTestUrl,
                      TenantDomainUrl: row.TenantDomainUrl
                    }))
                this.setState({ data: results });
              }
            })
            .catch(error =&gt; {
              console.error(error);
            });
        };
  
  
      componentDidMount(){
          this.fetchData();
      }
  
      render() {
          const columns = [
                  {
                      title: 'Client Id',
                      dataIndex: 'ClientId',
                      key: 'ClientId'
                  }, 
                  {
                      title: 'Site Collection TestUrl',
                      dataIndex: 'SiteCollectionTestUrl',
                      key: 'SiteCollectionTestUrl',
                  },
                  {
                      title: 'Tenant DomainUrl',
                      dataIndex: 'TenantDomainUrl',
                      key: 'TenantDomainUrl',
                  }
          ];
  
          // rowSelection object indicates the need for row selection
          const rowSelection = {
              onChange: (selectedRowKeys, selectedRows) =&gt; {
                  if(selectedRows[0].key != undefined){
                      console.log(selectedRows[0].key);
  
  
                      const options = { 
                          method: 'post', 
                          body: JSON.stringify({ clientid : selectedRows[0].key.toString() }) ,
                          config: {
                              headers: {
                                'Content-Type': 'application/json'
                              }
                            }
                      };
  
                      adalApiFetch(fetch, "/Tenant/SetTenantActive", options)
                          .then(response =&gt;{
                          if(response.status === 200){
                              Notification(
                                  'success',
                                  'Tenant set to active',
                                  ''
                                  );
                          }else{
                              throw "error";
                          }
                          })
                          .catch(error =&gt; {
                          Notification(
                              'error',
                              'Tenant not activated',
                              error
                              );
                          console.error(error);
                      });
                  }
              },
              getCheckboxProps: record =&gt; ({
                  type: Radio
              }),
          };
  
          return (
              &lt;Table rowSelection={rowSelection} columns={columns} dataSource={this.state.data} /&gt;
          );
      }
  }
  
  export default ListTenants;
  </code></pre>
  
  <p>and the webapi method</p>
  
  <pre><code>[HttpPost]
          [Route("api/Tenant/SetTenantActive")]
          public async Task&lt;IHttpActionResult&gt; SetTenantActive([FromBody]string clientid)
          {
              var tenantStore = CosmosStoreFactory.CreateForEntity&lt;Tenant&gt;();
              var allTenants = await tenantStore.Query().Where(x =&gt; x.TenantDomainUrl != null).ToListAsync();
              foreach(Tenant ten  in allTenants)
              {
                  ten.Active = false;
                  await tenantStore.UpdateAsync(ten);
              }
  
              var tenant = await tenantStore.Query().FirstOrDefaultAsync(x =&gt; x.clientid == clientid);
              if (tenant == null)
              {
                  return NotFound();
              }
  
              tenant.Active = true;
              var result = await tenantStore.UpdateAsync(tenant);
  
              return Ok(result);
          }
  </code></pre>