title: How can we hide a property in WebAPI?
body: <p>I have a model say under</p>
  
  <pre><code>public class Device
  {        
          public int DeviceId { get; set; }
          public string DeviceTokenIds { get; set; }
          public byte[] Data { get; set; }
          public string FilePwd { get; set; }        
  }
  </code></pre>
  
  <p>Now I have a ASP.net Web API where there is a POST method as under</p>
  
  <pre><code>[HttpPost]
  [Route("AddDeviceRegistrations")]
  public void InsertDeviceRegistrations(Device device)
  </code></pre>
  
  <p>If I expose the WebAPI, obviously all the fields will be available e.g.</p>
  
  <pre><code>{
    "DeviceId": 1,
    "DeviceTokenIds": "sample string 2",
    "Data": "QEBA",
    "FilePwd": "sample string 3"
  }
  </code></pre>
  
  <p>What I want is that, whenever I expose my WebAPI, the DeviceID should not get expose. I mean I am looking for</p>
  
  <pre><code>{
  
        "DeviceTokenIds": "sample string 2",
        "Data": "QEBA",
        "FilePwd": "sample string 3"
  }
  </code></pre>
  
  <p>Is it possible? If so how?</p>
  
  <p>I can solve the problem by changing the function signature as </p>
  
  <pre><code>public void InsertDeviceRegistrations(string deviceTokenIds, byte[] data, string FilePwd).
  </code></pre>
  
  <p>But I wanted to know if it can be possible or not ?
  If so , how?</p>
  
  <p>Thanks in advance.</p>