title: How to get unread message via rest api in Rocket.chat
body: <p>Hello I have used this <a href="https://docs.rocket.chat/api/rest-api/methods/channels/history" rel="nofollow noreferrer">https://docs.rocket.chat/api/rest-api/methods/channels/history</a> for get unread message via rest API.</p>
  <p><strong>Example Call</strong></p>
  <ol>
  <li><p>(<a href="https://rcserver.rocket.chat/api/v1/im.history?roomId=ByehQjC44FwMeiLbX?&amp;unreads=true" rel="nofollow noreferrer">https://rcserver.rocket.chat/api/v1/im.history?roomId=ByehQjC44FwMeiLbX?&amp;unreads=true</a>)</p>
  </li>
  <li><p>(<a href="https://rcserver.rocket.chat/api/v1/im.history?roomId=ByehQjC44FwMeiLbX?&amp;unreads=%E2%80%9D+" rel="nofollow noreferrer">https://rcserver.rocket.chat/api/v1/im.history?roomId=ByehQjC44FwMeiLbX?&amp;unreads=”+</a> true)</p>
  </li>
  </ol>
  <p><strong>Code</strong></p>
  <pre><code>HttpClient client = new HttpClient();
  client.BaseAddress = new Uri(Constants.CONST_SITEURL);
  client.DefaultRequestHeaders.Accept.Add(
  new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
  client.DefaultRequestHeaders.Add(&quot;X-Auth-Token&quot;, authToken);
  client.DefaultRequestHeaders.Add(&quot;X-User-Id&quot;, userRcId);
  HttpResponseMessage msgHistory = client.GetAsync(Constants.CONST_CHATHISTORY + userDetail.RC_RoomID + &quot;&amp;count=20&amp;unreads=true&quot;).Result;
       if (msgHistory.IsSuccessStatusCode)
           {
             using (HttpContent content = msgHistory.Content)
                     {
                        var result = content.ReadAsStringAsync();
                        value = JObject.Parse(result.Result);
                      }
             directChatWindow = JsonConvert.DeserializeObject&lt;DirectChatWindowBO&gt;(value.ToString());
           }
  </code></pre>
  <p>I have try to above link and code but it will not give any unread property in  result</p>
  <p><strong>Example Result</strong></p>
  <pre><code>{
  &quot;messages&quot;: [
   {
    &quot;_id&quot;: &quot;7e6691fc-16sdfd3-ecbfsd8-317a-4076bb307e5dfsfd-4564&quot;,
    &quot;rid&quot;: &quot;CBsDHB7M8fsdfsdfN8G4X2BjsBDt5khnkenENacLN&quot;,
    &quot;msg&quot;: &quot;hittti&quot;,
    &quot;ts&quot;: &quot;2017-08-16T11:08:21.011Z&quot;,
    &quot;u&quot;: {
      &quot;_id&quot;: &quot;CBsDHsdadsaB7M8N8G4X2Bj&quot;,
      &quot;username&quot;: &quot;xyz&quot;,
      &quot;name&quot;: &quot;xyz21&quot;
    },
    &quot;mentions&quot;: [],
    &quot;channels&quot;: [],
    &quot;_updatedAt&quot;: &quot;2017-08-16T11:08:21.013Z&quot;
  },
  {
    &quot;_id&quot;: &quot;eaf75056-bcxcvxcv40c-4a68-0128-c40503289d60&quot;,
    &quot;rid&quot;: &quot;CBsDHxcvB7M8cvxvxcvN8G4X2BjsBDt5kxcvhnkenENacLN&quot;,
    &quot;msg&quot;: &quot;hi&quot;,
    &quot;ts&quot;: &quot;2017-08-16T11:07:53.579Z&quot;,
    &quot;u&quot;: {
      &quot;_id&quot;: &quot;CBsDHB7M8N8G4X2Bj&quot;,
      &quot;username&quot;: &quot;Abc&quot;,
      &quot;name&quot;: &quot;Abc123 &quot;
    },
    &quot;mentions&quot;: [],
    &quot;channels&quot;: [],
    &quot;_updatedAt&quot;: &quot;2017-08-16T11:07:53.583Z&quot;
  }]
  }
  </code></pre>
  <p>Please help me out.
  Thank You.</p>