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) »
  • V4 api brainstorm
Pages: [1]

Author Topic: V4 api brainstorm  (Read 2035 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
V4 api brainstorm
November 02, 2010, 11:52:54 pm
Hi,

You find the api clunky, miss a feature, or simply like to brake things ? This is your chance, as we have a window to introduce non compatible changes for the 4.0.

What I'd like to change :

1) Replace the existing authentication solution with a real one (OAuth) on the REST.
2) Introduce an anonymous mode and finer access control. Eg. I want to make it easier to create a public api, eg. of all my members, probably being able to define what fields/data can be queried
3) Make the api really uniform (eg. same names of action for all entities, contact_id vs. cid vs. id...)
4) Be sure that what is returned by a _get can be used on a _update
5) being able to chain API calls instead of having complicated methods (eg. contact create)
6) Adding a versionning. Either on a per api call, or during the initial authentication letting the client tell it wants the api v2.0, so we are able to fine tune or introduce changes without braking everything.


Something that might not be directly related, but quite a pain is a proper documentation/discovery mode. That's one of the few things I miss from SOAP, being able to see what are the available apis, and even more importantly, what are the right params.

I've bought the RESTful Web Services Cookbook (o reilly), will read it. It would be really nice if one of you can look at the APIs from the big boys (google api for contact), twitter... and check what Salesforce/sugarCRM do.

Not sure the forum is the right place. Shall I start a wiki or does it exist already ?

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: V4 api brainstorm
November 07, 2010, 12:45:43 am
Hi Xavier,

I'd really like to see us getting somewhere with the 'self-documenting' explain/ discover function. I agree with Michal/ Piotr that using good code commenting / PHPDoc would be a good idea. However, the convention for code commenting is fairly limited - e.g. it tells you that you can pass in a $params array but doesn't mention the possible fields in that array.

An explain option (however) could return the possibilities based on a combination of:

a function with std options for the type of operation (e.g. GET)
a function that returns custom fields for the entity
a function that returns the dao fields for the entity
a function that returns hard-coded 'extras' for the specified function

We could compare the variables returned by this function against the Unit Test in some way

On other things

- I think the *current* consensus is not to have an UPDATE function where a CREATE with entity_id will do (e.g. there might be an update for something like address update where the instruction would be 'replace existing home mobile with this' but for contact, for example, you would use create to update the individual with contact_id x. I guess you are suggesting a change of consensus to a chained approach?


My other question is how do we migrate - I'm thinking that maybe we need a v3 with all the correct names & core error catching & a v4 with all the other bits & pieces. The could sit in different folders & the API can call the folder that matches the version name (default is 2). I realise this does involve shipping more than one API (which Lobo was against) but I *think* the main problem with shipping more than one is support & a fairly ruthless approach of only supporting the most recent of any given API is more easily applied to APIs than the rest of the code (i.e if a v3 of contact exists we would tell people to switch & then we'll help. Since all they would need to do to switch would be to change the version parameter it wouldn't be a biggie. The include they use wouldn't change in this scenario (a file in the top level about the v2 etc folders where the to-be deprecated code is right now)
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: V4 api brainstorm
November 07, 2010, 02:07:03 am
Hi,

Michal is going to unveil the http://api.civicrm.org tomorrow. Should blow your mind ;)

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: V4 api brainstorm
November 07, 2010, 02:44:28 am
Will it cook dinner & wash my socks?
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: V4 api brainstorm
November 07, 2010, 04:06:28 am
Quote from: Eileen on November 07, 2010, 02:44:28 am
Will it cook dinner & wash my socks?

And even more. Two limitations:
1) civicrm_prepare_bath ({'waterTemperature': degree}. you will have to  your expected water temperature to Celsius degree (handling Fahrenheit is scheduled for v5).

2) civicrm_sandwich_make: has a mandatory sudo (boolean) parameter

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: V4 api brainstorm
November 07, 2010, 04:09:43 am
I would have though farenheit was due to be deprecated anyway....
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: V4 api brainstorm
November 10, 2010, 02:26:54 am
Any chance of civicrm_warm_british_bear or civicrm_delete_marmite?
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: V4 api brainstorm
November 16, 2010, 10:43:53 am
You meant civicrm_marmite_delete

(not sure api standardisation is good stand up comedy material)

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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: V4 api brainstorm
November 16, 2010, 10:49:59 am
I think you guys are doing great with the humour so far. Warm British Bears are a direct result of climate change forcing the polar variety to move south.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: V4 api brainstorm
November 16, 2010, 10:54:40 am
Eric - I think this is a prime example of a poor naming convention.

civicrm_warm_british_bear()

and

civicrm_warm_british_beer

Are quite different functions. I believe the second was the intended syntax
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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: V4 api brainstorm
November 16, 2010, 11:13:40 am
actually is the _british_ needed at all - doesn't warm_beer do the necessary? (I will stop now)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: V4 api brainstorm
November 30, 2010, 07:31:40 pm
So, on the issue I have been banging on about on whether we support field names in v4 or whether we support unique name (if exists else field name) I have hit an example (still on pledge BAO example) where the field name is ambiguous

If running a pledge_get with the return property of contribution_type I get a query based on returning me the contribution_type for all contributions for that contact. The contribution types for the object I am querying (pledge) aren't returned at all.

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) »
  • V4 api brainstorm

This forum was archived on 2017-11-26.