Skip to main content

GROWING AND SUSTAINING RELATIONSHIPS

GROWING AND SUSTAINING RELATIONSHIPS
Close
Mark Cridge

End-User and Admin

Green Party of England & Wales

http://www.greenparty.org.uk

We use CiviCRM for our Membership and Supporters system. We're committed to using Open Source solutions and are keen to expand the variety and success of our member recruitment and fundraising efforts.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Erik Hommel

Implementer, Developer

EE-atWork

http://www.ee-atwork.nl

CiviCRM helps the organizations we support to do what they have to do! At EE-atWork we assist our customers with implementing and using CiviCRM. This includes functional support, training, project management, data migration, integration using the API and customization. We are based in The Netherlands.

Our customers are mainly non-profits, varying from larger organizations continuously improving the way CiviCRM supports them to smaller organizations using the core functionality and perhaps contributing to a Make It Happen. We have been active in the CiviCRM community since 2009. CiviCRM is all about community, sharing and producing together. We truly believe that one and one can be three!

GROWING AND SUSTAINING RELATIONSHIPS
Close
Karen Morrissey

Administrator

Democratic Party of Denver

http://www.denverdemocrats.net

We use CiviCRM to communicate with our members and volunteers.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Michael McAndrew

Implementor, Trainer, Documentator and Developer.

Third Sector Design

http://www.thirdsectordesign.org

CiviCRM helps us help non profits to do fantastic things with their data.
Being closely involved with the developers and documentation team on a daily basis ensures that we can give our clients the best and most up to date advice on how they can use CiviCRM to meet their needs.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Paul Keogan

Implementor

BackOfficeThinking

http://www.backofficethinking.com

CiviCRM allows us to bring all benefits and capabilities of a large commercial CRM and
donor management system to medium and large non-profits at a fraction of the cost. CiviCRM also allows smaller non-profits to benefit from an integrated solution for donor management, events, bulk email, etc. substantially increasing their effectiveness as compared to managing a variety of nonintegrated software and spreadsheets. Thanks to a strong CiviCRM community, CiviCRM’s functionality continues to advance and CiviCRM’s market continues to grow rapidly.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Pablo Sullivan

Administrator, End-user

Movimiento por la Paz -MPDL-

http://www.mpdl.org

We needed a CRM, found CiviCRM and fell in love with it :). We're starting with 4.3, we hope we can be of some help for future updates.

GROWING AND SUSTAINING RELATIONSHIPS
Close
David Greenberg

Core Team Member

CiviCRM

http://civicrm.org

I find the engagement with our community of users to be intellectually stimulating
and rewarding. Seeing folks with expertise in a particular area step up and contribute their time and ideas to help improve the product is quite exciting. Every time I hear about a new interesting organization starting to use CiviCRM, I get a renewed sense of excitement about our work. The range of civic sector organizations currently using the software is quite amazing to me - from large international advocacy organizations to local performing arts troupes. I also really enjoy interacting with our international community - building friendships and getting to share culture (food, music, humor ....) with colleagues on every continent.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Alan Dixon

Implementor, Developer, Administrator

Blackfly Solutions

http://blackflysolutions.ca/

We recommend and use CiviCRM with most of our clients, and have since 2005. It's got a fantastic collection of functionality that fits the needs of non-profit organization communications, and the CiviCRM community of developers and users is growing, broad, vibrant and responsive.

The best part? When I describe to potential new converts how all of their constituent relations (donations, membership, mass emails, etc.) can be managed with a single integrated, configurable tool, I can hear an incredible yearning at the other end of the phone.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Arthur Richards

DEVELOPER

WIKIMEDIA FOUNDATION

http://wikimediafoundation.org

At the Wikimedia Foundation, we leverage CiviCRM to maintain millions of records of donors and their contributions. Working with the product and particularly with the community has been a terrific experience. There's nothing quite like two open source organizations working together to meet their respective goals while ultimately strengthening the open source community as a whole.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Andrew Hunt

Implementor, Developer

AGH Strategies

http://aghstrategies.com

CiviCRM allows our clients to have a robust tool for tracking and engaging their supporters that can grow with them. I began as an end user, and now I work with CiviCRM full-time.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Kellie Brownell

End-user

EFF

https://www.eff.org

The CiviCRM community has been a tremendous resource for new ideas and helping us solve problems. We are excited to contribute customizations EFF makes back to core and support new features such as batch entry for offline donations or multiple payment processors on one donation form.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Graham Mitchell

Implementor, Administrator, end-user, Trainer

MC3

http://mc3.coop

I've been working with CiviCRM since 2006 or thereabouts. The community is outstanding in providing support and sharing expertise, which combines with a strong product to enable me in turn to deliver better results for the organisations that I work with. I only hope that over time I will be able to repay the debt by supporting other newcomers to CiviCRM.

LOGIN | REGISTER
  • Create new account
  • Request new password

Search form

  • BLOG
  • DEMO
  • Find An Expert
  • NEED HELP
  • SUPPORT US
  • DEVELOPER RESOURCES
CiviCRM Community Site logo CiviCRM Community Site
  • WHAT IS CIVICRM
    • Community
    • Case Studies
    • Experts
    • Contributors
    • Core Team
    • Licensing
    • Contact Us
  • WILL CIVICRM MEET YOUR NEEDS?
    • Contacts
    • Contributions
    • Communications
    • Peer-To-Peer Fundraisers
    • Advocacy Campaigns
    • Events
    • Members
    • Reports
    • Case Management
  • GET STARTED
    • Evaluate Your CRM Needs
    • Evaluate CiviCRM Features
    • Read Books
    • Contact an Ambassador
    • Demo CiviCRM
    • Download CiviCRM
    • Download Extensions
    • Find An Expert
  • PARTICIPATE
    • Join the community
    • Make it happen
    • Support CiviCRM
    • Meet ups
    • Document CiviCRM
    • Translate CiviCRM
    • Developer resources

You are here

Home » Blogs » Eileen's blog

Blog

  • API
  • Architecture Series
  • CiviCampaign
  • CiviCase
  • CiviCon
  • CiviContribute
  • CiviCRM
  • CiviCRM v4.1
  • CiviEvent
  • CiviMail
  • CiviMember
  • CiviMobile
  • CiviPledge
  • CiviReport
  • Documentation
  • Drupal
  • Extensions
  • Finance and Accounting
  • Interface Design and Layout Standards
  • Internationalization and Localization
  • Joomla
  • Make it happen
  • Marketing and Promotion
  • Meetups
  • Older Versions
  • Release
  • Schools
  • Solutions (case studies and user stories)
  • Sprints
  • Teams
  • Training
  • v1.6
  • v1.7
  • v1.8
  • v1.9
  • v2.0
  • v2.1
  • v2.2
  • v2.3
  • v3.0
  • v3.1
  • v3.2
  • v3.3
  • v3.4 and v4.0
  • v4.2
  • v4.3
  • WordPress

API in CiviCRM 4.1 - under-the hood

Submitted by Eileen on March 7, 2012 - 17:52

Although the API changes in 4.1 are not as obvious as took place in 3.4/4.0 there have been quite a few changes under the hood. This is a fairly detailed explanation of what's going on inside the API wrapper.

 

The way in which required fields & default values are set has been changed to be more consistent and to be self documenting.

 

For example if you look at the auto-generated (PHPDOC) documentation for Note API you will see that entity_id & note are marked as 'required' and that the default value for 'entity_table' is civicrm_contact. The default value for modified_date is 'now'  (the api accepts 'now' along with other relative dates for date fields).

 

This information, about required fields defaults set at the API level is available by querying the API - e.g.

 

civicrm_api('note','getfields',array('version' =>3, 'action' => 'create')); 

 

The api explorer also uses the getfields function to provide information about the API. The metadata is defined in the API using _spec functions which are called by the getfields function- e.g.

/*
 * Adjust Metadata for Create action
 *
 * The metadata is used for setting defaults, documentation & validation
 * @param array $params array or parameters determined by getfields
 */
function _civicrm_api3_note_create_spec(&$params){
  $params['entity_table']['api.default'] = "civicrm_contact";
  $params['modified_date']['api.default'] = "now";
  $params['note']['api.required'] =1;
  $params['entity_id']['api.required'] =1;
}

The Metadata functions can also be used to document additional fields - for example 'country' has been added to the bottom of address_create.

When you call an API (e.g. note_create) it follows this process:

 

  1. It converts any aliases defined in the getfields function

    - e.g. it understands from getfields that pledge_contact_id is the same as contact_id. pledge_contact_id is the unique name defined in the schema whereas contact_id is the field name. After quite a lot of discussion we settled on the standard being the field name for create functions & the unique name for get functions. This was due to the requirement of unique names by the query object. However, in the past the two have been used somewhat randomly so the alias conversion should mean that both work. In the delete function '$entity_id' is converted to 'id'. The alias mechanism can also be used to state that 'if label is not set then use the value in name'.

  2. If 'id' is not set then the defaults are retrieved (using getfields) and merged into the array being passed in.

    (in the past this was done ad hoc in the functions & didn't always take account of whether or not id was set (e.g. CRM-9763). It also interacted badly at times with the required checking).

  3.  The resulting array is checked against the mandatory fields.

    If id is set then only version is mandatory.

  4. The validate fields function is called.

    This performs transformation on any date fields using string-to-time. If the date is not valid it will throw an error.

  5. At the end If the function fails due to a foreign constraint error (e.g. invalid contact_id) then the validate_fields function is called

    by the create_error function in error mode and it will check all the foreign constraints & provide more detailed information. This is intended to replace the numerous checks ad hoc in the various API for validity of fields. Doing it only on failure is more efficient. We intend in future to allow a 'strict' mode where you can invoke this extra error checking up-front while developing.

The validate_fields mechanism has a way to go but we hope to completely replace functions like _civicrm_api3_contact_check_params with api layer wrapping. The movement of so much of the api functionality to the API wrapper is why we do not support any access to any api functions from outside the API except via the wrapper. At the moment about 40% of the API crud functions are only 1 line of code. Our goal is that should reach about 80%. See survey api for an example 

 

 

Going forwards on our API simplification / refactoring we want to try to better resolve how the API interacts with the BAO

. In particular we want to standardise the BAO functions for create and delete so that we can always call the same function from the api (not sometimes add, sometimes create or on the other side sometimes del sometimes delete) and so that they always expect the same variable input.

 

The other area where there are often problems is that the various bits of processing & setting of defaults in Core is sometimes done in the form and sometimes in the BAO - this leads to the API not acting as people expect. It also limits the extent to which we can document the defaults. In some cases functionality that people expect the api to leverage is not there because the forms implement it. Or, in the case of sending contribution receipts, it is attached to the payment processor IPN rather than the contribution BAO. Unravelling these issues will take time.

  • Eileen's blog
  • Log in or register to post comments

Comments

Great wrap up!

Permalink Submitted by xavier on March 8, 2012 - 23:12

A few additional points:

the api.getfields can't take an extra action parameter because 'action' is a reserved name (as is entity or version), so we'll find an alias for that (api_action is the best candidate so far)

As getfields is used a lot of time, it's important it's fast. So far, we have a problem with non us language (it contains plenty of calls to the translate function), we will improve it in a future version

Making a (more) coherent api exposed the incoherences of the BAO (eg. the same method is called differently on different BAOs) indeed. This is a non-trivial refactoring, and might be better left as a point to keep in mind if/when we move to symfony.

 

It would be great if some of the 50 sprinters (or so I've been told) could work on moving to generic and/or add the _spec for validation

 

X+

  • Log in or register to post comments

refactoring BAO

Permalink Submitted by Eileen on March 11, 2012 - 15:09

I wouldn't aim to get all the BAO refactored in any one sprint - but I do think we should move quickly on agreeing what the standard functions should be & identifying where they can easily be standardised & where it will take longer. Some of the really dodgey ones actually don't involve a lot of code & would be technically easy to tidy up - if we knew what we were tidying to.

Standardisation is a great prep for moving to another DB layer.

  • Log in or register to post comments

CIVICRM


GROWING AND SUSTAINING RELATIONSHIPS

WHAT IS CIVICRM
  • Community
  • Case Studies
  • Experts
  • Contributors
  • Core Team
  • Licensing
  • Contact Us
WILL CIVICRM MEET YOUR NEEDS?
  • Contacts
  • Contributions
  • Communications
  • Peer-To-Peer Fundraisers
  • Advocacy Campaigns
  • Events
  • Members
  • Reports
  • Case Management
GET STARTED
  • Evaluate Your CRM Needs
  • Evaluate CiviCRM Features
  • Read Books
  • Contact an Ambassador
  • Demo CiviCRM
  • Download CiviCRM
  • Download Extensions
  • Find An Expert
PARTICIPATE
  • Join the CiviCRM Community
  • Read Our Blog
  • Community Forum
  • Attend a Training or Meetup
  • Make It Happen
  • Become A CiviCRM Developer
  • Issue Tracker
  • Help with Documentation
  • Translate