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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Retrieve a memberlist using API
Pages: [1]

Author Topic: Retrieve a memberlist using API  (Read 912 times)

frinaldi

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.17
  • MySQL version: 5.1.48
  • PHP version: 5.2.10
Retrieve a memberlist using API
July 11, 2011, 12:37:57 am
Dear all,

I must create a script to find all organization that are currently members of an organization (so having a specific membership type). I take a look at the API but I didn't find a search method that can give me this answer :

http://wiki.civicrm.org/confluence/display/CRMDOC31/Membership+APIs

We are using CiviCRM 3.3.6 under Drupal.

Many thanks for your help
Fred

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Retrieve a memberlist using API
July 11, 2011, 01:22:19 am

Might be great if you can take a look at api v3 in 3.4.4 and improve it to be a more comprehensive search rather than the current limited function:

civicrm_api3_membership_get in api/v3/Membership.php

Would be great and help make api v3 better :) Ensure you do add unit tests when you improve the function :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Retrieve a memberlist using API
July 11, 2011, 01:27:51 am
This is how to do a membership_get on membership_type_id in v3 of the api

http://svn.civicrm.org/civicrm/branches/v3.4/api/v3/examples/MembershipGet.php

but you'd have to backport it to 3.3.6....
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

frinaldi

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.17
  • MySQL version: 5.1.48
  • PHP version: 5.2.10
Re: Retrieve a memberlist using API
July 13, 2011, 04:22:38 am
OK, I'll try. But just to be sure I'm going on the right direction : I should use SQL query to find the correct "contact list" according to the function parameters or is there a better way to interact with the DB using some API function.

One more time, thank you

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Retrieve a memberlist using API
July 13, 2011, 06:17:08 am
If you look in one of the 'simpler' v3 API's (phone, address, tag) you will see that the DAO is used to access the database. Most of it should speak for itself? But please ask questions if it is not clear  :)
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Retrieve a memberlist using API
July 13, 2011, 07:34:54 am
Hi,

I would simply backport it to your version. Check out a previous message, that's basically about copying api/v3/* and api/api.php

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Retrieve a memberlist using API

This forum was archived on 2017-11-26.