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) »
  • CiviCRM API Limitations
Pages: [1]

Author Topic: CiviCRM API Limitations  (Read 2105 times)

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
CiviCRM API Limitations
February 23, 2011, 09:01:15 am
Hey Guys,


We are facing some limitations of the CiviCRM REST API/CiviCRM code while working with it for CiviSync. See below.
 
  • CiviCRM API gives you a list of deleted contacts as well. And there is no way to identify if a contact has been deleted or not. i.e. No log entry
  • CiviCRM contact and group relationship updates. Group and Tags are not logged and hence if a contact has been added to a group or removed from a group it is not possible to get the data from the API. Of course it is not even logged in the database so not only the API but the code of civicrm will need further improvement.
  • There is a confusion and I won’t yet say that is a limitation of the API but when we are trying to get the contacts which were updated from the last update time. If the computer time has been changed for any reason there is a possibility that the contacts sync may get mixed up. Not sure if it will be good to have server time made available through the API.

That’s all for now. Let me know your thoughts or let me know if we are correct in understanding the system.
 
Regards
Rohit
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviCRM API Limitations
February 23, 2011, 09:39:23 am
    Quote from: polestar on February 23, 2011, 09:01:15 am
    • CiviCRM API gives you a list of deleted contacts as well. And there is no way to identify if a contact has been deleted or not. i.e. No log entry

    I think Erik has worked on that on the api v3 already. if not, have you tried passing a is_deleted = 0 param ?

    @erik, could you confirm ?

    Quote from: polestar on February 23, 2011, 09:01:15 am

    • CiviCRM contact and group relationship updates. Group and Tags are not logged and hence if a contact has been added to a group or removed from a group it is not possible to get the data from the API. Of course it is not even logged in the database so not only the API but the code of civicrm will need further improvement.

    As you said, this one isn't an API issue but something on the underlying system. I'm sure that the new log system is super useful, but doesn't seem to cover properly that need.

    I would like to have the civicrm_log extended with two new columns:
    * action: (create, update, delete)
    * id_contact
    and beside the existing places where we log the changes ( civicrm_activity, civicrm_contact, civicrm_domain, civicrm_event, civicrm_participant) add civicrm_group_contact and civicrm_entity_tag

    @lobo, what do you think ?


    Quote from: polestar on February 23, 2011, 09:01:15 am

    • There is a confusion and I won’t yet say that is a limitation of the API but when we are trying to get the contacts which were updated from the last update time. If the computer time has been changed for any reason there is a possibility that the contacts sync may get mixed up. Not sure if it will be good to have server time made available through the API.

     

    Might be useful to add an api 'config' and an action ''gettime', so would solve the tz problem.

    If you change the server time, well, you shouldn't ;)

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

    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: CiviCRM API Limitations
    February 24, 2011, 02:29:36 am
    The is_deleted as a parm should work, see issue http://issues.civicrm.org/jira/browse/CRM-7384
    Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

    polestar

    • I post frequently
    • ***
    • Posts: 162
    • Karma: 11
      • Target Integration
    Re: CiviCRM API Limitations
    February 24, 2011, 11:18:45 am
    @x+
    Quote
    I would like to have the civicrm_log extended with two new columns:
    * action: (create, update, delete)
    * id_contact
    and beside the existing places where we log the changes ( civicrm_activity, civicrm_contact, civicrm_domain, civicrm_event, civicrm_participant) add civicrm_group_contact and civicrm_entity_tag
    I double that. In the absence of a log populated with group changes we will not be able to sync the groups efficiently. Any thoughts most welcome.

    Quote
    Might be useful to add an api 'config' and an action ''gettime', so would solve the tz problem.
    We will be more than happy to implement this API if it can be included in the core?

    @erik
    Thanks for that. We are working with API v2 and civicrm version 3.2 at the moment
    CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
    Target Integration | www.targetintegration.com
    Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

    xavier

    • Forum Godess / God
    • I’m (like) Lobo ;)
    • *****
    • Posts: 4453
    • Karma: 161
      • Tech To The People
    • CiviCRM version: yes probably
    • CMS version: drupal
    Re: CiviCRM API Limitations
    February 24, 2011, 02:51:48 pm
    Quote from: polestar on February 24, 2011, 11:18:45 am
    I double that. In the absence of a log populated with group changes we will not be able to sync the groups efficiently. Any thoughts most welcome.

    ? If everytime in the BAO of group_contact when you Create Update Delete you add an entry (contact_id, group_id) the changes are added in the log and so you can fetch all the latest changes, no ?

    Quote from: polestar on February 24, 2011, 11:18:45 am
    We will be more than happy to implement this API if it can be included in the core?

    I think having a config (that could be extended to read/write the language, currency...) would be ok to get a gettime that returns the date on the server.

    This being said, all the new features should be added on the new branch, and hence on api v3.

    Eileen, Erik, Lobo, any comment ?

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

    polestar

    • I post frequently
    • ***
    • Posts: 162
    • Karma: 11
      • Target Integration
    Re: CiviCRM API Limitations
    March 01, 2011, 06:59:43 am

    Quote from: xavier on February 24, 2011, 02:51:48 pm

    ? If everytime in the BAO of group_contact when you Create Update Delete you add an entry (contact_id, group_id) the changes are added in the log and so you can fetch all the latest changes, no ?
    Sorry Xavier... I meant that I support the idea of having a log like above. Now the question is what is required to implement this.

    Any comments from others????
    CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
    Target Integration | www.targetintegration.com
    Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

    xavier

    • Forum Godess / God
    • I’m (like) Lobo ;)
    • *****
    • Posts: 4453
    • Karma: 161
      • Tech To The People
    • CiviCRM version: yes probably
    • CMS version: drupal
    Re: CiviCRM API Limitations
    March 01, 2011, 12:50:55 pm
    Hi,

    I was suggesting to use the existing civicrm_log table, but improved to handle your case

    Quote
    I would like to have the civicrm_log extended with two new columns:
    * action: (create, update, delete)
    * id_contact
    and beside the existing places where we log the changes ( civicrm_activity, civicrm_contact, civicrm_domain, civicrm_event, civicrm_participant) add civicrm_group_contact and civicrm_entity_tag

    So beside changing the schema, would be modify the Group & TAG BAO so it adds a record in the log on the create update and delete.
    X+
    -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: CiviCRM API Limitations
    March 01, 2011, 11:25:39 pm
    Quote
    I think having a config (that could be extended to read/write the language, currency...)

    Does this overlap at all with the Constant api? (not currently working or compliant in v3)


    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

    Pages: [1]
    • CiviCRM Community Forums (archive) »
    • Old sections (read-only, deprecated) »
    • Developer Discussion »
    • APIs and Hooks (Moderator: Donald Lobo) »
    • CiviCRM API Limitations

    This forum was archived on 2017-11-26.