Answers.Body: <p>I have just checked the API call in Civi 4.4 installation and the getcount with the group parameter on Contact does not work.</p>
  
  <p>Also the API call on GroupContact does not work either. What you could do is probably write a small extension which includes a getcount api for Group memberships.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-05T13:18:16.920Z
Answers.Text: Thanks.  As mentioned below in the conversation with ErikH, I switched to Get rather than GetCount.  That works well enough for my needs - it's in a spot which is used only occasionally.
Answers.UserDisplayName: ASav
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-05T08:16:40.317Z
Answers.LastActivityDate: 2015-11-05T08:16:40.317Z
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.Body: <p>That error does not ring a bell to me and we use CiviCRM 4.4 (and the API) quite a lot. As Jitendra already tried on the demo site I will give it a try on one of my installs...and the getcount on the contact works perfectly in the API explorer?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T12:16:05.947Z
Answers.Text: That's really odd.  All my tests are only in the api explorer.  And as described above, in 4.4 count works, getcount doesn't.  I don't know what could be wrong/different on my install since it's the api explorer.  Hmm.
Answers.UserDisplayName: ASav
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T12:27:47.967Z
Answers.Text: Is there any customization on your installation that might touch the underlying BAO functions? Obiously it should not....but just to be sure to be sure :-)
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T14:27:30.070Z
Answers.Text: Good question, but no.  To be sure I deleted custom code and templates directories and uninstalled custom modules. Flushed all caches and retested. No change in behavior.  Thanks for the suggestion.  At this point I've re-coded and will use get. Not ideal but it works.
Answers.UserDisplayName: ASav
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T14:53:59.960Z
Answers.Text: Weird though :-(
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T06:18:21.147Z
Answers.LastActivityDate: 2015-10-06T06:18:21.147Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>It appears that the Contact GetCount API is not working properly in 4.4 to retrieve group counts.  I can code around it by switching to Get which works fine, but wanted to see if there was something I was missing. (I'm upgrading from a 4.2.6 site which works fine.)  My specific example is a smart group, but I've tried non-smart groups as well with the same result.</p>
  
  <p>Using the api/explorer ....</p>
  
  <p><strong>On my 4.4.19 test site</strong></p>
  
  <p>The GetCount is wrong</p>
  
  <p>/civicrm/ajax/rest?json=1&amp;sequential=1&amp;debug=1&amp;&amp;entity=Contact&amp;action=getcount&amp;group=82  returns { "is_error":0, "result":1 }</p>
  
  <p>But the get is right
  /civicrm/ajax/rest?/civicrm/ajax/rest?entity=Contact&amp;action=get&amp;debug=1&amp;sequential=1&amp;json=17&amp;group=82  returns ... "count":9,  ....</p>
  
  <p><strong>But on my 4.2.6 live site</strong></p>
  
  <p>The GetCount and Get are both correct</p>
  
  <p>/civicrm/ajax/rest?json=1&amp;sequential=1&amp;debug=1&amp;&amp;entity=Contact&amp;action=getcount&amp;group=82  returns { "is_error":0, "result":8 }</p>
  
  <p>/civicrm/ajax/rest?/civicrm/ajax/rest?entity=Contact&amp;action=get&amp;debug=1&amp;sequential=1&amp;json=17&amp;group=82  returns .... "count":8,</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-06T05:45:00.877Z
Comments.Text: I can see the getCount returning correct result on the 44 demo site http://d44.demo.civicrm.org/. Checked for `/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount&group=3`
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-06T12:12:15.893Z
Comments.Text: That returns {
   "is_error":0,
   "result":5474
  } which is the full count of my contact list no matter what group ID I include.
Comments.UserDisplayName: ASav
Tags: <api><groups>
Title: GetCount not implemented on 4.4?
ThreadText: # GetCount not implemented on 4.4?
  
  (Asked by: username_0 on 2015-10-05)
  
  It appears that the Contact GetCount API is not working properly in 4.4 to retrieve group counts. I can code around it by switching to Get which works fine, but wanted to see if there was something I was missing. (I'm upgrading from a 4.2.6 site which works fine.) My specific example is a smart group, but I've tried non-smart groups as well with the same result.
  
  Using the api/explorer ....
  
  **On my 4.4.19 test site**
  
  The GetCount is wrong
  
  /civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount&group=82 returns { "is\_error":0, "result":1 }
  
  But the get is right
  /civicrm/ajax/rest?/civicrm/ajax/rest?entity=Contact&action=get&debug=1&sequential=1&json=17&group=82 returns ... "count":9, ....
  
  **But on my 4.2.6 live site**
  
  The GetCount and Get are both correct
  
  /civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount&group=82 returns { "is\_error":0, "result":8 }
  
  /civicrm/ajax/rest?/civicrm/ajax/rest?entity=Contact&action=get&debug=1&sequential=1&json=17&group=82 returns .... "count":8,
  
  **Tags:** api, groups
  
  > **Comments:**
  > **username_1**: I can see the getCount returning correct result on the 44 demo site http://d44.demo.civicrm.org/. Checked for `/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount&group=3`  
  > **username_0**: That returns {  "is_error":0,  "result":5474 } which is the full count of my contact list no matter what group ID I include.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-11-05. Score: 1
  
  I have just checked the API call in Civi 4.4 installation and the getcount with the group parameter on Contact does not work.
  
  Also the API call on GroupContact does not work either. What you could do is probably write a small extension which includes a getcount api for Group memberships.
  
  > **Comments:**
  > **username_0**: Thanks.  As mentioned below in the conversation with username_3, I switched to Get rather than GetCount.  That works well enough for my needs - it's in a spot which is used only occasionally.  
  
  ---
  
  ### Answer by username_3 on 2015-10-06. Score: 0
  
  That error does not ring a bell to me and we use CiviCRM 4.4 (and the API) quite a lot. As username_1 already tried on the demo site I will give it a try on one of my installs...and the getcount on the contact works perfectly in the API explorer?
  
  > **Comments:**
  > **username_0**: That's really odd.  All my tests are only in the api explorer.  And as described above, in 4.4 count works, getcount doesn't.  I don't know what could be wrong/different on my install since it's the api explorer.  Hmm.  
  > **username_3**: Is there any customization on your installation that might touch the underlying BAO functions? Obiously it should not....but just to be sure to be sure :-)  
  > **username_0**: Good question, but no.  To be sure I deleted custom code and templates directories and uninstalled custom modules. Flushed all caches and retested. No change in behavior.  Thanks for the suggestion.  At this point I've re-coded and will use get. Not ideal but it works.  
  > **username_3**: Weird though :-(  
  
  ---
  
  