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) »
  • What's the point of the API
Pages: [1]

Author Topic: What's the point of the API  (Read 961 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
What's the point of the API
June 06, 2012, 04:44:49 pm
Now that API v3 has been mostly bedded in & a good number of things have been sorted out the question of how we maintain it is becoming increasingly topical. Maintenance is never much fun as building things :-) & decisions have to be made about what to maintain. So, the question on this thread is very topical.

I have always believed that the primary point of the API is to provide developers with an interface that hardly changes between versions & makes CiviCRM viable to develop against - without worrying that your customisations & integration will break every upgrade.

To me that means not only keeping the API code consistent but buffering developers against CiviCRM core changes (within reason). So, for example with 4.2 coming out one area I noticed was

that the following call ('event','create', array('title' => 'blah', 'payment_processor_id' => 1);

will no longer work due to schema changes (http://issues.civicrm.org/jira/browse/CRM-10297)

Which leaves us with 3 possibilities

1) We add extra functions into the api to handle these things e.g

civicrm_api3_event_create_legacy42(&$params){
// change old format to new format
}

(We could remove the functions over time - or just when we got to v4 api)

2) We let developers deal with the fallout & don't care

3) we document a series of relevant changes each release (much like 1 but on a wiki rather than in code)

4) We document the changes by returning an error (much like #1 & #3 but we rely on the developers noticing it).

Probably there is little difference in effort required between the options but who does it will vary. For example - dealing with developers griping (#2) is likely to be done by whoever deals with the forums.

I strongly believe there where it is obvious what the behaviour would be if the old params are passed in we should support it - #1. But if I'm alone on that then I'm in trouble - it might be like being the only person who believes the dishes need to be washed & put away.


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: What's the point of the API
June 07, 2012, 12:13:05 am
Hi,

I think that's pretty clear that we should strive maintaining compatibility, and pretty obvious for everyone.

Is this the answer you are looking for, or is this how to share the cleaning task?

One problem is that the api is at the end of the chain (as in very seldom used by the core itself), so api compatibility risk being an afterthought, and when we change something in the core, we don't realise the impact on the api until long after.

I think the whole goal of the API is to let the core being able to break compatibility, but IMO maintaining the API compatibility needs to be part of the MIH.

I don't understand the change enough to give a specific answer to the event/payment, but if too complicated/illogical to maintain, at least clearly identify it will break and add a proper error message on the API, and add that on the release doc.

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: What's the point of the API
June 07, 2012, 12:17:02 am
BTW, breaking a test is definitely what I consider a regression that should be handled.

If we break something that wasn't tested, I think we have more giggle room to decide if it's "broken for real or broken on something that wasn't used anyway", as in "you're using an undocumented feature, tough shit if it changes". Hopefully, that's going to be a good incentive to users to add tests in the API.
-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: What's the point of the API
June 07, 2012, 01:51:22 am
I think the technical issue is less that the - how do we make sure it happens issue & how do we get buy-in to ensuring the API shields integrators from core changes & how do we spread the burden of that work?

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

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: What's the point of the API
June 07, 2012, 02:55:18 pm

a few thoughts and comments:

a. IMO, core should not maintain backward compatibility for schema changes. We are fairly aggressive in improving the schema and/or fixing past mistakes. Adding backward compatiblity will make the task a lot harder and increase code size / add conversion stuff etc.

b. IMO, the api team might want to consider maintaining backward compatibility for some changes and not necessarily all changes. Trapping and returning an error for the other changes is a decent option

c. Finally, the question remains as to who does the needed work at the API layer. We can add it to the MIH, but what happens if the MIH does not get fulfilled completely (as is the case with quite a few of the 4.1 MIH's). Ultimately we do need more developers willing to contribute hours / code to make things more complete. Expecting eileen to do it for the api team or the dim-sum team to do it all is not scalable and/or sustainable

my 2 cents

lobo


A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: What's the point of the API
June 07, 2012, 03:46:38 pm
I'm not sure trapping & returning an error is any less work than handling an change in a useful way - but it does make sense when the appropriate action is unclear.

One of the problems with CiviCRM is that it there is a fairly relentless upgrade schedule & people who upgraded less than 6 months ago find themselves told they are using an unsupported version & bug fixes are not being released for that version (even in some cases where they are regression bugs). There are obvious upsides to this (rapid feature development) but traditionally upgrades have been pretty fraught affairs - with both CiviCRM & Custom Code breaking.

In order to combat the first of these we have committed to a much more prudent approach to feature freeze. For the second of these we tried to push more stable hooks & api - but if we want them to be stable we need to do something about it.

Of course, the issue about getting more people to put in more time is the nub.
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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: What's the point of the API
July 03, 2012, 09:36:06 pm
I have fixed the identified bug - I realised that not to do so would be essentially to declare the api pointless

http://issues.civicrm.org/jira/browse/CRM-10297

However, I need help identifying other schema changes that make affect API users in 4.2
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

CallFirst

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.2
Re: What's the point of the API
July 14, 2012, 04:12:20 pm
 Eileen,
I guess I don't know enough about the CiviCRM beneficiaries, to fully grasp why anyone involved commercially with supporting the product would not agree that a stable API is central to their own self interests.  I doubt there are many.. but there may be a few folks in your "expert community", who mistakenly view a viable and stable API as competition; that could potentially limit the market for their expert knowledge and expertise.  IMHO, I would think getting funding commitments for the API really boils down to making a solid  case to the "community of experts" who make a living off providing commercial support for CIVICRM. 

What not formally reach out to the panel of experts and sell them on why a stable API is in their own self interest.  Maybe they can reach a consensus among themselves, that the viability of the product, their long term success, and the privilege of being listed as an "Expert" dictates financial support for the API.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: What's the point of the API
July 15, 2012, 03:02:45 pm
I guess the issue is that my definition of a stable API perhaps goes beyond some other peoples - in that I think it should buffer developers / custom code from any internal changes. The second issue is that I feel writing this buffering should be part of any development - not just part of the API remit.
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) »
  • What's the point of the API

This forum was archived on 2017-11-26.