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) »
  • Chained / nested api queries
Pages: [1]

Author Topic: Chained / nested api queries  (Read 1894 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Chained / nested api queries
May 25, 2011, 12:58:46 am
 I have implemented the first stage of chaining as per our conversations
 - hopefully this will fully replace the proposed ContactActivity api
 http://issues.civicrm.org/jira/browse/CRM-8148
 
 Details here....
 
 http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+Public+APIs#CiviCRMPublicAPIs-Nested/Chainedcalls
 
 And examples
 http://svn.civicrm.org/civicrm/branches/v3.4/api/v3/examples/ContactCreate.php
 
 http://svn.civicrm.org/civicrm/branches/v3.4/api/v3/examples/ContactGet.php

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

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: Chained / nested api queries
May 25, 2011, 01:27:44 am
Looks good!!!! Earned yourself a warm beer yet again......(can wait for CiviCon in London where they sell lots of warm beer). I will have a play this afternoon and get back with the votes from the jury.
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: Chained / nested api queries
May 25, 2011, 01:31:00 am


Follow up of the chat with Eileen on how to do it from the ajax/rest interface, might be that the easiest/cheapest for the rest interface is to use json formating, eg:

civicrm/ajax/rest?Entity=Contact&action=Get&contact_id=34&api.Activity.Get={activity_type_id:42,status_id:1}

Plan B:
or that api.Activity.Get sets a namespace eg. "act1", so
civicrm/ajax/rest?Entity=Contact&action=Get&contact_id=34&api.Activity.Get=act1&act1.activity_type_id=42&act1.status_id=1





-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: Chained / nested api queries
May 25, 2011, 01:38:17 am
this is the quesion of how best to represent an array in a 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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Chained / nested api queries
May 25, 2011, 01:42:04 am
Yeap, sorry, context was a bit lost between our skype chat last night and now ;)

with the chained api, some params (api.Entity.Action= array)

Works fine with a php call, not so good with an ajax call (GET or POST param)
-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: Chained / nested api queries
May 25, 2011, 01:45:01 am
if json is the best format for this we should do it - is the : in Coleman's syntax OK with JSON?
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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Chained / nested api queries
May 25, 2011, 01:56:33 am
We are back to custom fields, right ?

It should be, will have to test, and might be needed to add a backslash in front (but don't think so)

http://www.json.org

While we are on syntax, are we sure that a custom field and custom set names *can't* contain a ":" ?
-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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Chained / nested api queries

This forum was archived on 2017-11-26.