Skip to main content

GROWING AND SUSTAINING RELATIONSHIPS

GROWING AND SUSTAINING RELATIONSHIPS
Close
Alejandro Salgado

Implementor, Consultant

iXiam

http://www.ixiam.com/en

We help organizations with their CiviCRM Projects. From Business consultancy to custom CiviCRM development.

GROWING AND SUSTAINING RELATIONSHIPS
Close
John Derry

Implementor, Administrator, Trainer, Architect

John Derry

http://www.johnderry.com.au

Magazine subscriptions management can be done by CiviCRM.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Robin Tombs

Supporter

Zing

http://www.zing.uk.com

Zing is a user of Civi software.
Zing wants to see more NFPs use Civi software.
Zing is helping fund further Civi software development and outreach.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Margaret Thom

User, Administrator

Biodynamic Farming & Gardening Association

http://www.biodynamics.com

Online and offline membership sign-up and renewal,donations and event registration, integrated with our Drupal website. Directory for members, group and bulk emails, renewal reminder emails. Exciting to have complex conference registration within our CRM. Impressed with the Civi community and ongoing development of new features and improvements.

GROWING AND SUSTAINING RELATIONSHIPS
Close
David Moreton

Consultant, Implementor and End-user

Circle Interactive

http://www.civisites.com

We help many not for profits implement CiviCRM through consultancy, training, configuration and custom development. Many of them come from a painful world of old Access databases, multiple spreadsheets and even paper. It's really satisfying to
help people move on with a system that's so much in tune with their own ethics of sharing and collaboration. We also 'eat our own dog food' and use Civi in-house for our client records because we love the flexibility and control it gives us.

For us it's important to share code and advice with other members of the community when we can because we know we get it back in help at other times. The community really is awesome and one of the friendliest and undaunting I've come across. We appreciate the huge value of the software to us and our clients so we try to contribute back and make it even better.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Adam Clamp

Consultant & Developer

The Green IT Company

It helps us provide our clients with an excellent community and group management tool. We can also build upon many existing Drupal sites as CiviCRM now uses this CMS as its foundation.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Andrew Wasson

Implementor, Developer

Luna Design

http://www.lunadesign.org

We produce custom civiCRM/Drupal solutions for professional organizations and societies to satisfy their membership management needs. In its standard configuration, civiCRM provides a great deal of functionality and its integration with Drupal is outstanding.

We are also active in extending civiCRM with custom extension modules which are in development at our Github account(https://github.com/awasson)

GROWING AND SUSTAINING RELATIONSHIPS
Close
Adam Wight

Developer

Wikimedia Foundation

http://wikimediafoundation.org/

Civi is one of those pieces of software that makes you wonder how early humans could have survived without it. Every nonprofit seems to be using Civi for some aspect of their fundraising, and I'm always surprised at the creative ways different people find to make it work for their needs. Happy to be able to help out a bit. There's a lot of energy going into this project--definitely checkout the forums and the IRC channel if you're curious.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Peter McAndrew

Implementor, Developer

Third Sector Design

http://www.thirdsectordesign.org

Being part of the CiviCRM community is really something to shout about! Not only is CiviCRM an amazing software package, its designed for organisations that make a difference in the world. We help non-profits across the UK gain control of their data through the power of CiviCRM.

It is without a doubt the best piece of software I've ever worked with, and I'm constantly discovering cool new features. More recently I've been working on CiviMobile as part of a project for my course at University. I'm really looking forward to seeing this being used by organisations across the globe.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Philippe Gervaix

Implementor

ISHR

http://www.ishr.ch

ISHR is currently in the early stages of implementing CiviCRM, and is finding the customisable aspects of the software to be especially beneficial.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Shane Hill

Implementor, Service Provider, Administrator, Consultant, End-user

CiviSMTP

http://www.civismtp.com

I run the CiviSMTP Service that provides an easy and reliable way to send your newsletters using CiviCRM on Drupal/Joomla/WordPress platforms.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Sarah Gladstone

Implementor, Developer

Pogstone, Inc.

http://pogstone.com

I have been involved in the CiviCRM community for over 5 years, and enjoy implementing and programming CiviCRM for a variety of non-profits. I have been amazed at the rapid pace of innovation delivered with each new release, and CiviCRM's flexibility in being able to accommodate a variety of requirements. I have learned a lot about CiviCRM by participating in CiviCon, online forums, and CiviCRM book sprint.

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 » totten'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

Extending APIv3

Submitted by totten on September 28, 2011 - 18:31

CiviCRM 3.4.x and 4.0.x introduced API v3, a more consistent set of interfaces for integrating with CiviCRM using PHP, Smarty, Javascript, and REST. Building on this consistent core API, recent CiviCRM updates have introduced even more ways to manipulate your data -- such as chaining and CSV batch importing.

Thus, functions implemented according to the API v3 conventions can be invoked several different ways. If you would like to leverage this infrastructure for use with a new or customized API call, then download the latest release. With 3.4.6/4.0.6, external developers can expose API functions for new entities, new actions, and even generic actions.

This would, for instance, allow you to create an API that returns the top donations of a person, grouped by contribution type... or any consolidated data. Instead of having to call a lot of APIs and consolidate the result yourself, you can write you own api.contribution.top, either by doing directly the right SQL queries or by using existing simpler APIs. Your new API is then automatically available to AJAX, Smarty, the REST interface and PHP.

Preliminaries: PHP Include Path

To define new APIs, you will need somewhere to place the new PHP files. This directory must be part of the PHP include path. There are a couple ways to do this:

  • Put the new files in a Custom PHP directory
  • Put the new files in a Drupal module and add the module to the include path, e.g.
    <?php
    // FILE: sites/all/modules/example/example.module
    
    /**
     * Implementation of hook_civicrm_config
     */
    function example_civicrm_config(&$config) {
      $path = drupal_get_path('module', 'example');
      set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    }
    

In the rest of this document, file paths are relative to your chosen directory. Thus, if your directory is "/var/www/sites/all/modules/example", and if the relative path is "api/v3/Phone/Get.php", then the full path is "/var/www/sites/all/modules/example/api/v3/Phone/Get.php"

Define a new action for an existing entity

Suppose you want to implement an action, "get", for an entity called "Phone." You would need to create a new file with a new function

* File (Example): api/v3/Phone/Get.php
* Function (Example): civicrm_api3_phone_get($params)
* File (Formula): api/v${version}/${CamelCaseEntity}/${CamelCaseAction}.php
* Function (Formula): civicrm_api3_${lower_case_entity}_${lower_case_action}($params)

Define a generic action for all entities

Sometimes it's useful to define generic actions which build on top of existing actions. For example, the "create" action can be used to modify records, but it's not always user-friendly -- in some scenarios, if you forget to pass in a field for an existing record, you might inadvertently set the field to blank. To work around this, you might first "get" the full entity, then merge-in your changes, and finally call "create" to save the changes. This sequence of steps ("get"->"merge"->"create") can be a little tedious -- it's more convenient to define a new action, "update", which handles all these steps. "update" is a generic action:

* File (Example): api/v3/Generic/Update.php
* Function (Example): civicrm_api3_generic_update($apiRequest)
* File (Formula): api/v${version}/Generic/${CamelCaseAction}.php
* Function (Formula): civicrm_api3_generic_${lower_case_action}($apiRequest)

Define a new entity with several actions

As with previous releases, you can also create an API for a new entity which includes several actions, e.g.

<?php
// FILE: sites/all/modules/example/api/v3/MyEntity.php

/**
 * Implement the "get" action for "MyEntity"
 */
function civicrm_api3_my_entity_get($params) {
    ...your logic...
}

/**
 * Implement the "create" action for "MyEntity"
 */
function civicrm_api3_my_entity_create($params) {
    ...your logic...
}

Available Helpers

API v3 currently includes some helper functions which checking inputs and formatting outputs. Many API functions are implemented with this idiom:

<?php

/**
 * Implement the "myaction" action for "myentity"
 */
function civicrm_api3_myentity_myaction($params) {
    civicrm_api3_verify_mandatory($params, null,
        array('field_a', 'field_b', ...));
    $values = array();
    // ... run your logic, populating $values ...
    if (...logic hits error...) {
        return civicrm_api3_create_error('Error message...');
    } else {
        return civicrm_api3_create_success($values, $params);
    }
}
  • totten's blog
  • Log in or register to post comments

Comments

CiviCRM iCalendar export

Permalink Submitted by Guest (not verified) on September 30, 2011 - 08:34

Hi there,

I'm writing to you here because I'm only an indirect user of CiviCRM and I wasn't able to answer all the questions required in order to post a bug to a forum.

I'm trying to use this iCalendar feed from an CiviCRM system:

http://www.hannahgrimes.com/civicrm/event/ical?reset=1&page=1

It fails because of improper line folding: there's an erroneous \n at the beginning of every line where there should only be space. Seems like an easy fix.

Thanks,

Jon Udell

http://elmcity.cloudapp.net
http://icalvalid.cloudapp.net

  • Log in or register to post comments

See also

Permalink Submitted by totten on September 30, 2011 - 22:17

I've never worked with the CiviEvent iCal support, but some quick digging turned up a previous discussion about \n in iCal. You may want to read/comment on it:

http://forum.civicrm.org/index.php/topic,18379.msg76284.html

As far as the detailed forum signup questions, leave them blank (or use placeholders) and just explain the situation in your post.

  • Log in or register to post comments

Great blogpost

Permalink Submitted by ErikHommel on October 2, 2011 - 02:26

Thanks for putting it all together in a nice blogpost Tim! Very useful.

  • 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
  • Documentation
  • 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