CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Bug in Version 3 Contact Count API
Pages: [1]

Author Topic: Bug in Version 3 Contact Count API  (Read 2259 times)

Mohit Thakral

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 3.4.5+
  • CMS version: Drupal 6.24
  • MySQL version: 7.2
  • PHP version: 5
Bug in Version 3 Contact Count API
April 14, 2012, 11:05:00 am
Please execute following API request result is 25, where is total count of sample contacts is 102.

http://drupal.demo.civicrm.org/?q=civicrm/ajax/doc/api#/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount

Regards
Mohit Thakral
Mohit Thakral
www.targetintegration.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Bug in Version 3 Contact Count API
April 14, 2012, 12:43:48 pm
It's not a bug - although it makes less sense in 'getcount' than in other functions.

There is a parameter 'limit' which by default is set to 25. It might make sense to change that limit on the getcount function (which is actually just the get function with a different return format) but I think making it unlimited (e.g. 'limit' => 10,000,000) could be a problem as sometimes people have huge DBs & it they choose a bad combo of params it can  result in hammering the DB, Having said that we could also modify the return properties when getcount is called which would mitigate that somewhat.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mohit Thakral

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 3.4.5+
  • CMS version: Drupal 6.24
  • MySQL version: 7.2
  • PHP version: 5
Re: Bug in Version 3 Contact Count API
April 14, 2012, 08:04:37 pm
But, getcount is the function to be used to return the number of the records. So, it is suppose to return the count of records. Thats y it is not returning any records as such. It should return the exact count.
Mohit Thakral
www.targetintegration.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Bug in Version 3 Contact Count API
April 14, 2012, 08:30:39 pm
Yes, you can log that as an issue if you'd like.

To get yourself going now you can just set $params['limit'] => 1000000000 or similar
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mohit Thakral

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 3.4.5+
  • CMS version: Drupal 6.24
  • MySQL version: 7.2
  • PHP version: 5
Re: Bug in Version 3 Contact Count API
April 14, 2012, 08:40:38 pm
I am using Rest API , and using .Net to consume these reset services. Can you please help how can I pass limit 100000000000000 in Rest
Mohit Thakral
www.targetintegration.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Bug in Version 3 Contact Count API
April 14, 2012, 09:41:02 pm
You should be able to add &limit=1000000 to your url
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mohit Thakral

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 3.4.5+
  • CMS version: Drupal 6.24
  • MySQL version: 7.2
  • PHP version: 5
Re: Bug in Version 3 Contact Count API
April 14, 2012, 09:44:14 pm
I tried putting limit param in demo. It didn't work.

 http://drupal.demo.civicrm.org/?q=civicrm/ajax/doc/api#/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getcount

Regards
Mohit Thakral
Mohit Thakral
www.targetintegration.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Bug in Version 3 Contact Count API
April 14, 2012, 09:57:14 pm
sorry - try 'rowCount'
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mohit Thakral

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 3.4.5+
  • CMS version: Drupal 6.24
  • MySQL version: 7.2
  • PHP version: 5
Re: Bug in Version 3 Contact Count API
April 14, 2012, 10:53:32 pm
thanks a ton.. super awesome it worked :)
Mohit Thakral
www.targetintegration.com

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: Bug in Version 3 Contact Count API
July 28, 2012, 02:44:30 am
How do I get similar results with…

/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=GroupContact&action=get&group_id=19

Again, limits to 25 results, I want to return the amount of members in a group?
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Bug in Version 3 Contact Count API
July 28, 2012, 03:09:18 am
Try
/civicrm/ajax/rest?json=1&sequential=1&debug=1&entity=Contact&action=get&group=19&rowCount=42
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Bug in Version 3 Contact Count API
July 28, 2012, 02:37:50 pm
Try option.limit or option_limit (can't remember which)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: Bug in Version 3 Contact Count API
July 30, 2012, 03:36:29 pm
Thanks guys, will give it a go next time I have a moment…
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: Bug in Version 3 Contact Count API
August 05, 2012, 03:55:56 am
option_limit worked, thanks!
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Bug in Version 3 Contact Count API

This forum was archived on 2017-11-26.