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) »
  • GroupContact API -> v4 API needed?
Pages: [1]

Author Topic: GroupContact API -> v4 API needed?  (Read 665 times)

jcasharpe

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 5
    • Woodlands Church
  • CiviCRM version: 4.4.6
  • CMS version: Drupal 7
  • MySQL version: MariaDB 10.0.13
  • PHP version: 5.5
GroupContact API -> v4 API needed?
November 27, 2012, 02:17:13 pm
I have come across some of the limitations of the GroupContact API whilst trying to sync membership of a set of groups and some custom field select values.
Specifically I want to be able to call GroupContact Delete and only update the subscription history table when it actually removes the person from the group. Eileen said that the v3 api is a bit weird, partly due to the v2 api history and because of the concept of a soft remove.

I've worked around this for now by querying for membership before calling delete but this obviously is more api calls than should really be necessary for the task. It also seems that you can't get single group membership records, specifying both group_id and contact_id doesn't filter in the way one would expect.

Discuss!
« Last Edit: November 27, 2012, 02:55:46 pm by jcasharpe »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: GroupContact API
November 27, 2012, 02:20:36 pm
The question here is how do we deal with entrenched api oddities. This is one of a number of things we can't really change due to the need to support deprecated behaviour.

I had always thought that the driver for api v4 would be to start some api without the oddities (e.g add an api v4 folder & put in clean apis for those functions we are converting & build it up to a full clean stack of apis).

I'm starting to feel like we need to think about apiv4 more seriously.
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: GroupContact API -> v4 API needed?
November 28, 2012, 12:41:09 am
Quote from: jcasharpe on November 27, 2012, 02:17:13 pm
Specifically I want to be able to call GroupContact Delete and only update the subscription history table when it actually removes the person from the group.

What does it do now? does it create a new "removed" record even if the contact wasn't in the group?

If it's the case, we can consider it's a bug and fix it on v3 IMO.
-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: GroupContact API -> v4 API needed?
November 28, 2012, 01:50:21 pm
yes, that's what it does - but there is no way to actually remove a record - perhaps you are right - perhaps we should just fix it so it does a check first?
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) »
  • GroupContact API -> v4 API needed?

This forum was archived on 2017-11-26.