SlideShare a Scribd company logo
API v3 It does everything except make warm beer
What are we going to cover? What problem does it solve? Concepts and tools A Pretty Intuitive example A feel for the cutting edge  Advanced example The future is looking at you Q/A ?
What problem does it solve? Synchronising with an external system Adding a custom workflow Developing a new interface Changing the default behaviour   Any time you need to Create Read Update or Delete... almost anything (contact, event, contribution...)   Learn it once, use it everywhere
What is the API A standardised way of accessing data in CiviCRM through code More future proof than SQL or using internal functions The most supported way to interact with CiviCRM data from custom code Better tested (1200 tests and counting...)
What does an API call look like? Entity Action Params Contact (or one of 45 others!) Get, Create, Delete, Replace, getcount, getsingle, getvalue,  Array of relevant variables API Explorer: /civicrm/ajax/doc List of params: /civicrm/api/doc (as of the next version)
4 ways of accessing APIs PHP code REST {crmAPI} Ajax .crmAPI() PHP OO
A Pretty Intuitive example Functional requirement: Society visits companies in various countries, at the moment the visiting agents send in a report of the visit by email. This should be done online Solution in CiviCRM:   ?
Cheat Sheet Use the profile to get a list of companies to visit and the ability to change the company details Adda custom data set with activities of a specific type to hold the additional data  Use a hook to enhance the profile with additional data Use the API to add companies to a group and create an activity
The profile Profiles are a standard feature of CiviCRM Can be used to access or update CiviCRM data from 'outside'   In this case, the standard contact profile gives me a list of companies and a possibility to update the company details (address etc.)   But I need more......
The hook I need to add additional data to the profile, and I use CiviCRM hooks to do that Hooks can be used to insert your own code and processing in the CiviCRM processing In this case I used the buildForm hook to add data to the profile, and use the API to retrieve some additional contact data that is not on the profile:  $contactParms = array(     'version' => 3,     'check_permissions' => false,     'contact_id' => $userID); $result = civicrm_api( "Contact","get", $contactParms );
The API Finally the API is used to 'automatically' create an activity for the company and the visitor: $activityParms = array(    'version'              => 3,    'check_permissions'    => false,    'source_contact_id' => $sourceID,    'target_contact_id' => $id,    'activity_type_id' => 32,    'subject'          => "Bezoekverslag website",    'details'          => "blahblah",    'status_id'            => 2,    'activity_date_time'  => $activityDate,    'custom_35' => $veranderingJn); $result = civicrm_api( 'Activity', 'Create', $activityParms );
Pop quiz for the free beer - is it possible to create a participant record with a linked contribution in a single API call
  "yes, use API Chaining"   API Chaining passes the results from 1 API call into another.   API chaining relies on the fact that useless values are dropped by the receiving function If the chained  function  is the same as the higher level function 'id' is passed through from the higher function otherwise the id is passed through as '$entity_id' AND as 'entity_id', 'civicrm_entity' is also set. 'version' & 'sequential' are always set     http://svn.civicrm.org/civicrm/branches/v3.4/api/v3/examples/Participant/CreateParticipantPayment.php
The problem Garbage in/Garbage Out Nothing in/ Nothing out My users are too lazy to open a browser I'm even lazier than they are
The solution ? Introducing … Your personnal assistant Always awake That knows everything Always ready to take a note
Miss MoneyPenny From XMPP, with love
Planned features Extensible API new entities new actions   More complete same filters/options everywhere more sort criteria improve underlying BAOs   We need you! More tests a test is a contract, if you use the api in a different way, write a test and contribute
Testing    The API is heavily tested but there are still a lot of features not covered. If you want it to work after your next upgrade ... help make sure it's tested
Recent features   Chaining Extra functions getsingle getvalue (needs return=array('valuename') getcount replace  format.only_id format.is_success  sequential These are implemented in the 'wrapper' function & work across all API  
Recent features (in the generic API) These functions work on some API and are being implemented across them (as tests are written ) .    options('limit'); options('sort');  options('sort');  strtotime date handling (e.g. 6 months ago); filters e.g.    'filters' => array(         'activity_date_time_high' => '20120101000000' ,     ),  
Ad

More Related Content

What's hot (20)

Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir NazimDjango Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Mir Nazim
 
Integrating External APIs with WordPress
Integrating External APIs with WordPressIntegrating External APIs with WordPress
Integrating External APIs with WordPress
Marty Thornley
 
Plugins unplugged
Plugins unpluggedPlugins unplugged
Plugins unplugged
Christian Rokitta
 
Integrating WordPress With Web APIs
Integrating WordPress With Web APIsIntegrating WordPress With Web APIs
Integrating WordPress With Web APIs
randyhoyt
 
merb.intro
merb.intromerb.intro
merb.intro
pjb3
 
Introduction to Elgg
Introduction to ElggIntroduction to Elgg
Introduction to Elgg
niteshnandy
 
Einführung in die @4sqapi
Einführung in die @4sqapiEinführung in die @4sqapi
Einführung in die @4sqapi
Daniel Wiegand
 
Api
ApiApi
Api
randyhoyt
 
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
James Titcumb
 
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
James Titcumb
 
Ampersandjs
AmpersandjsAmpersandjs
Ampersandjs
Drew Fyock
 
Introduction To Elgg 1224395615749768 9
Introduction To Elgg 1224395615749768 9Introduction To Elgg 1224395615749768 9
Introduction To Elgg 1224395615749768 9
Mobicules Technologies
 
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Codemotion
 
IAP introduce@myBook
IAP introduce@myBook IAP introduce@myBook
IAP introduce@myBook
Jason Huang
 
Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)
Achmad Solichin
 
Effectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby ConfEffectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby Conf
neal_kemp
 
Heavybit Presents: Stripe's API Lead Amber Feng on API Design
Heavybit Presents: Stripe's API Lead Amber Feng on API DesignHeavybit Presents: Stripe's API Lead Amber Feng on API Design
Heavybit Presents: Stripe's API Lead Amber Feng on API Design
Dana Oshiro
 
Data validation in web applications
Data validation in web applicationsData validation in web applications
Data validation in web applications
srkirkland
 
Alexa Skills Kit
Alexa Skills KitAlexa Skills Kit
Alexa Skills Kit
Jun Ichikawa
 
Les06
Les06Les06
Les06
Vijay Kumar
 
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir NazimDjango Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
Mir Nazim
 
Integrating External APIs with WordPress
Integrating External APIs with WordPressIntegrating External APIs with WordPress
Integrating External APIs with WordPress
Marty Thornley
 
Integrating WordPress With Web APIs
Integrating WordPress With Web APIsIntegrating WordPress With Web APIs
Integrating WordPress With Web APIs
randyhoyt
 
merb.intro
merb.intromerb.intro
merb.intro
pjb3
 
Introduction to Elgg
Introduction to ElggIntroduction to Elgg
Introduction to Elgg
niteshnandy
 
Einführung in die @4sqapi
Einführung in die @4sqapiEinführung in die @4sqapi
Einführung in die @4sqapi
Daniel Wiegand
 
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
Best practices for crafting high quality PHP apps (PHP Yorkshire 2018)
James Titcumb
 
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
James Titcumb
 
Introduction To Elgg 1224395615749768 9
Introduction To Elgg 1224395615749768 9Introduction To Elgg 1224395615749768 9
Introduction To Elgg 1224395615749768 9
Mobicules Technologies
 
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Codemotion
 
IAP introduce@myBook
IAP introduce@myBook IAP introduce@myBook
IAP introduce@myBook
Jason Huang
 
Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)
Achmad Solichin
 
Effectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby ConfEffectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby Conf
neal_kemp
 
Heavybit Presents: Stripe's API Lead Amber Feng on API Design
Heavybit Presents: Stripe's API Lead Amber Feng on API DesignHeavybit Presents: Stripe's API Lead Amber Feng on API Design
Heavybit Presents: Stripe's API Lead Amber Feng on API Design
Dana Oshiro
 
Data validation in web applications
Data validation in web applicationsData validation in web applications
Data validation in web applications
srkirkland
 

Similar to CiviCRM API v3 (20)

Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...
Dean Peters
 
CGI Presentation
CGI PresentationCGI Presentation
CGI Presentation
Sopan Shewale
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
Neil Crookes
 
AIR & API
AIR & APIAIR & API
AIR & API
Arie Prasetyo
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
 
Shiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development GuidelinesShiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development Guidelines
Roy Pereira
 
Fraudpointer - Google Apps integration
Fraudpointer  - Google Apps integrationFraudpointer  - Google Apps integration
Fraudpointer - Google Apps integration
Fraudpointer.com
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
mrdon
 
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial GadgetsGetting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Atlassian
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
Pamela Fox
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
Stephan Schmidt
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best Practices
Jordan Open Source Association
 
Rey Bango - HTML5: polyfills and shims
Rey Bango -  HTML5: polyfills and shimsRey Bango -  HTML5: polyfills and shims
Rey Bango - HTML5: polyfills and shims
StarTech Conference
 
Forms With Ajax And Advanced Plugins
Forms With Ajax And Advanced PluginsForms With Ajax And Advanced Plugins
Forms With Ajax And Advanced Plugins
Manuel Lemos
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
olegmmiller
 
I Love codeigniter, You?
I Love codeigniter, You?I Love codeigniter, You?
I Love codeigniter, You?
إسماعيل عاشور
 
Php frameworks
Php frameworksPhp frameworks
Php frameworks
Anil Kumar Panigrahi
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on RailsSimple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Rails
jhenry
 
Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementation
Ashish Harbhajanka
 
Architect's Guide to Building an API Program
Architect's Guide to Building an API ProgramArchitect's Guide to Building an API Program
Architect's Guide to Building an API Program
clatimer
 
Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...
Dean Peters
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
Neil Crookes
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
 
Shiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development GuidelinesShiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development Guidelines
Roy Pereira
 
Fraudpointer - Google Apps integration
Fraudpointer  - Google Apps integrationFraudpointer  - Google Apps integration
Fraudpointer - Google Apps integration
Fraudpointer.com
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
mrdon
 
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial GadgetsGetting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Atlassian
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
Pamela Fox
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
Stephan Schmidt
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best Practices
Jordan Open Source Association
 
Rey Bango - HTML5: polyfills and shims
Rey Bango -  HTML5: polyfills and shimsRey Bango -  HTML5: polyfills and shims
Rey Bango - HTML5: polyfills and shims
StarTech Conference
 
Forms With Ajax And Advanced Plugins
Forms With Ajax And Advanced PluginsForms With Ajax And Advanced Plugins
Forms With Ajax And Advanced Plugins
Manuel Lemos
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
olegmmiller
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on RailsSimple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Rails
jhenry
 
Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementation
Ashish Harbhajanka
 
Architect's Guide to Building an API Program
Architect's Guide to Building an API ProgramArchitect's Guide to Building an API Program
Architect's Guide to Building an API Program
clatimer
 
Ad

Recently uploaded (20)

Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Ad

CiviCRM API v3

  • 1. API v3 It does everything except make warm beer
  • 2. What are we going to cover? What problem does it solve? Concepts and tools A Pretty Intuitive example A feel for the cutting edge Advanced example The future is looking at you Q/A ?
  • 3. What problem does it solve? Synchronising with an external system Adding a custom workflow Developing a new interface Changing the default behaviour   Any time you need to Create Read Update or Delete... almost anything (contact, event, contribution...)   Learn it once, use it everywhere
  • 4. What is the API A standardised way of accessing data in CiviCRM through code More future proof than SQL or using internal functions The most supported way to interact with CiviCRM data from custom code Better tested (1200 tests and counting...)
  • 5. What does an API call look like? Entity Action Params Contact (or one of 45 others!) Get, Create, Delete, Replace, getcount, getsingle, getvalue, Array of relevant variables API Explorer: /civicrm/ajax/doc List of params: /civicrm/api/doc (as of the next version)
  • 6. 4 ways of accessing APIs PHP code REST {crmAPI} Ajax .crmAPI() PHP OO
  • 7. A Pretty Intuitive example Functional requirement: Society visits companies in various countries, at the moment the visiting agents send in a report of the visit by email. This should be done online Solution in CiviCRM:   ?
  • 8. Cheat Sheet Use the profile to get a list of companies to visit and the ability to change the company details Adda custom data set with activities of a specific type to hold the additional data Use a hook to enhance the profile with additional data Use the API to add companies to a group and create an activity
  • 9. The profile Profiles are a standard feature of CiviCRM Can be used to access or update CiviCRM data from 'outside'   In this case, the standard contact profile gives me a list of companies and a possibility to update the company details (address etc.)   But I need more......
  • 10. The hook I need to add additional data to the profile, and I use CiviCRM hooks to do that Hooks can be used to insert your own code and processing in the CiviCRM processing In this case I used the buildForm hook to add data to the profile, and use the API to retrieve some additional contact data that is not on the profile:  $contactParms = array(     'version' => 3,     'check_permissions' => false,     'contact_id' => $userID); $result = civicrm_api( "Contact","get", $contactParms );
  • 11. The API Finally the API is used to 'automatically' create an activity for the company and the visitor: $activityParms = array(   'version'              => 3,   'check_permissions'    => false,   'source_contact_id' => $sourceID,   'target_contact_id' => $id,   'activity_type_id' => 32,   'subject'          => "Bezoekverslag website",   'details'          => "blahblah",   'status_id'            => 2,   'activity_date_time'  => $activityDate,   'custom_35' => $veranderingJn); $result = civicrm_api( 'Activity', 'Create', $activityParms );
  • 12. Pop quiz for the free beer - is it possible to create a participant record with a linked contribution in a single API call
  • 13.   "yes, use API Chaining"   API Chaining passes the results from 1 API call into another.   API chaining relies on the fact that useless values are dropped by the receiving function If the chained function is the same as the higher level function 'id' is passed through from the higher function otherwise the id is passed through as '$entity_id' AND as 'entity_id', 'civicrm_entity' is also set. 'version' & 'sequential' are always set    http://svn.civicrm.org/civicrm/branches/v3.4/api/v3/examples/Participant/CreateParticipantPayment.php
  • 14. The problem Garbage in/Garbage Out Nothing in/ Nothing out My users are too lazy to open a browser I'm even lazier than they are
  • 15. The solution ? Introducing … Your personnal assistant Always awake That knows everything Always ready to take a note
  • 16. Miss MoneyPenny From XMPP, with love
  • 17. Planned features Extensible API new entities new actions   More complete same filters/options everywhere more sort criteria improve underlying BAOs   We need you! More tests a test is a contract, if you use the api in a different way, write a test and contribute
  • 18. Testing   The API is heavily tested but there are still a lot of features not covered. If you want it to work after your next upgrade ... help make sure it's tested
  • 19. Recent features   Chaining Extra functions getsingle getvalue (needs return=array('valuename') getcount replace format.only_id format.is_success sequential These are implemented in the 'wrapper' function & work across all API  
  • 20. Recent features (in the generic API) These functions work on some API and are being implemented across them (as tests are written ) .    options('limit'); options('sort'); options('sort');  strtotime date handling (e.g. 6 months ago); filters e.g.   'filters' => array(       'activity_date_time_high' => '20120101000000' ,     ),